- Windows 10
- XAMPP (for MySql is running)
- Clone or download this code this code
- Create database named as laravel_tutorial
- Edit environments (.env)
DB_DATABASE=laravel_tutorial
DB_USERNAME=root
DB_PASSWORD=
- create model BlogPost with migration script
php artisan make:model BlogPost --migration
- edit migration script
Schema::create('blog_posts', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('title');
$table->longText('content');
$table->timestamps();
});
- Run migrations
php artisan migrate
- Create Controller
php artisan make:controller BlogPostController --resource --model=BlogPost
-
Update the blank method (refer to the code) in BlogPostController
-
Run php artisan serve