Answers for "how to migrate and seed"

PHP
3

laravel seed migrate

php artisan migrate:refresh --seed
Posted by: Guest on November-25-2020
2

use migration to run seeder

<?php

// inside migration file
public function up()
{
    // Create a table here

    // Call seeder
    Artisan::call('db:seed', [
        '--class' => 'SampleDataSeeder',
        '--force' => true // <--- add this line
    ]);
}
Posted by: Guest on August-14-2021

Browse Popular Code Answers by Language