In the previous tutorial, we learned how to setup authentication in Laravel 8 using Bootstrap. In this article, we will build on top of that.

We will create basic CRUD web application — CRUD means Create, Read, Update, & Delete. Thus, we will learn how to do these operations in Laravel 8.

Note: I am not explaining how to install and start project here since this article is sequel to previous post. If you are new here, please start from  Laravel 8 Authentication using Bootstrap 4

Since, we already have Laravel project with authentication in place, let’s create a Blog !

Step 1): Create Database Table

First of all, we will need to create additional database table to store our blog posts. Right? Let’s get on it!

php artisan make:migration create_posts_table --create=posts

This will create migration for creating posts table for you. We just need to update it to add columns we need, so modify the file as below:

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePostsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->text('body');
            $table->datetime('published_at')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('posts');
    }
}

Now, run the migration to create the table:

php artisan migrate

#laravel #laravel 8 #bootstrap

Laravel 8 Tutorial - Basic CRUD Blog Tutorial with Bootstrap
13.05 GEEK