Laravel CRUD tutorial

Development environment

  1. Windows 10
  2. XAMPP (for MySql is running)
  3. Clone or download this code this code

Step by Step

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

Source Code

https://github.com/fakhrul/laravel_tutorial