# Laravel 8 - Migration and Seeding ## Migration > php artisan make:migration create_posts_table veya > php artisan make:migration create_posts_table --create=posts **2021_05_31_080826_create_posts_table.php** ```php /** * Run the migrations. * * @return void */ public function up() { Schema::create('posts', function (Blueprint $table) { $table->id(); $table->string('title'); $table->text('body'); $table->timestamps(); }); } ``` > php artisan migrate ## Seeder > php artisan make:seeder PostTableSeeder **PostTableSeeder.php** ```php <?php namespace Database\Seeders; use Illuminate\Database\Seeder; use Illuminate\Support\Facades\DB; use Faker\Factory as Faker; class PostTableSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { $faker = Faker::create(); foreach (range(1, 100) as $index) { DB::table('posts')->insert([ 'title' => $faker->sentence(5), 'body' => $faker->paragraph(4) ]); } } } ``` **DatabaseSeeder.php** ``` php <?php namespace Database\Seeders; use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder { /** * Seed the application's database. * * @return void */ public function run() { // \App\Models\User::factory(10)->create(); $this->call([ StudentSeeder::class, ]); } } ``` > composer dump-autoload > php artisan db:seed > php artisan migrate:fresh --seed