Update TagsTableSeeder to fill created_at and updated_at fields as well
MODIFY
app/Tag.php
app/Tag.php
@@ -5,5 +5,5 @@ namespace App;
use Illuminate\Database\Eloquent\Model;
class Tag extends Model {
- public $timestamps = false;
+ //
}

MODIFY
database/seeds/TagsTableSeeder.php
database/seeds/TagsTableSeeder.php
@@ -6,19 +6,21 @@ use App\Tag;
class TagsTableSeeder extends Seeder {
public function run() {
+ $names = [
+ 'Groceries',
+ 'Bills',
+ 'Transport'
+ ];
+
+ foreach ($names as $name) {
+ $currentTimestamp = date('Y-m-d H:i:s');
+
Tag::insert([
- [
- 'user_id' => 1,
- 'name' => 'Groceries'
- ],
- [
'user_id' => 1,
- 'name' => 'Bills'
- ],
- [
- 'user_id' => 1,
- 'name' => 'Gas & Fuel'
- ]
+ 'name' => $name,
+ 'created_at' => $currentTimestamp,
+ 'updated_at' => $currentTimestamp
]);
}
}
+}

Update TagsTableSeeder to fill created_at and updated_at fields as well