Create model/migration for tags
ADD
app/Tag.php
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Tag extends Model {
+ //
+}

MODIFY
database/migrations/2017_07_23_111013_create_spendings_table.php
database/migrations/2017_07_23_111013_create_spendings_table.php
@@ -9,6 +9,7 @@ class CreateSpendingsTable extends Migration {
Schema::create('spendings', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
+ $table->integer('tag_id')->unsigned()->nullable();
$table->date('date');
$table->string('description');
$table->float('amount');

ADD
database/migrations/2017_07_23_184043_create_tags_table.php
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTagsTable extends Migration {
+ public function up() {
+ Schema::create('tags', function (Blueprint $table) {
+ $table->increments('id');
+ $table->integer('user_id')->unsigned();
+ $table->string('name');
+ });
+ }
+
+ public function down() {
+ Schema::dropIfExists('tags');
+ }
+}

Create model/migration for tags