Reputation: 331
Hi I have the following seeder class I am trying to seed. When I run the php artisan db:seed command the only thing that seeds is my previous seeder class I created a few weeks ago. I have no idea what I am missing. I inserted SoftDeletes and Protected fillables as well.
Here is my seeder class:
public function run()
{
DB::table('leave_type')->insert([
[
'leaveType' => 'Vacation Leave'
],
[
'leaveType' => 'Sick Leave'
],
[
'leaveType' => 'Afternoon Off'
],
[
'leaveType' => 'Special Leave'
],
[
'leaveType' => 'Study Leave'
],
]);
}
My model:
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class LeaveType extends Model
{
protected $fillable = ['leaveType'];
protected $table ="leave_type";
use SoftDeletes;
public $timestamps = true;
}
Upvotes: 1
Views: 2811
Reputation: 24116
Converting my comment to answer;
composer dump-auto
{PROJECT}/database/seeds/DatabaseSeeder.php
like this:$this->call(YourNewSeeder::class);
Then you could refresh the database (rollback all migration, re-run the migration) and run the seeder in one go with this command:
php artisan migrate:refresh --seed
or just run the specific seeder only like this:
php artisan db:seed --class=YourNewSeeder
Upvotes: 4