Rename user_id field in tags table to space_id
MODIFY
app/Space.php
app/Space.php
@@ -9,4 +9,9 @@ class Space extends Model {
use SoftDeletes;
protected $dates = ['deleted_at'];
+
+ // Relations
+ public function tags() {
+ return $this->hasMany(Tag::class);
+ }
}

MODIFY
app/User.php
app/User.php
@@ -32,10 +32,6 @@ class User extends Authenticatable {
return $this->hasMany(Recurring::class);
}
- public function tags() {
- return $this->hasMany(Tag::class);
- }
-
public function budgets() {
return $this->hasMany(Budget::class);
}

MODIFY
database/migrations/2017_07_19_000000_create_tags_table.php
database/migrations/2017_07_19_000000_create_tags_table.php
@@ -8,7 +8,7 @@ class CreateTagsTable extends Migration {
public function up() {
Schema::create('tags', function (Blueprint $table) {
$table->increments('id');
- $table->integer('user_id')->unsigned();
+ $table->unsignedInteger('space_id');
$table->string('name');
$table->timestamps();
$table->softDeletes();

Rename user_id field in tags table to space_id