I am using Laravel 5.4.
When I first created a project, I did migration and seeding and all worked fine.
Now I deleted the database and wanted to redo migration and seeding again, migration worked, but seeder does not.
When I entered this command:
php artisan db:seed
the result I got was:
Seeding: xxxTableSeeder
No error, no result was seed. And I should have 4 tables to be seeded but none of it being seeded.
I tried
composer dump-autoload
but not working as well.
DatabaseSeeder.php
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$this->call(ATableSeeder::class);
$this->call(BTableSeeder::class);
$this->call(CTableSeeder::class);
$this->call(DTableSeeder::class);
}
}
ATableSeeder.php
use Illuminate\Database\Seeder;
class ATableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('A')->insert([
'username' => '',
'firstname' => '',
'lastname' => '',
'email' => '',
'contact' => '',
'password' =>,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
]);
}
}
Any idea why?
It was the 'timezone
' in config/app.php
caused the issue. When I first migrated with the default timezone, which is 'UTC', everything works fine. Then I changed the timezone to 'UTC+8', and created_at and updated_at are working fine too. Then here comes the problem. I did migration again with the timezone 'UTC+8' and then stuck at the seeding part.
So now I changed the timezone to 'Asia/Kuala_Lumpur', everything is working perfectly fine!
Thank you guys!