• Techblog369, India
  • March 28, 2023

How To Configure A Sendinblue SMTP Relay in Postfix?

Fix Email Issues in CyberPanel with SMTP Relay Setup Free Method. First Create a email using your Cyberpanel Under Emai Tab Create Email Second go to the SSL tab and click …

Create a simple password strength indicator with JavaScript

You’ve probably seen many examples of password strength indicators around the web. They let users know the password they’re using is weak and indicate how the strength changes when it’s modified. …

In this article, I am going to create a Blog project using Laravel 8 step by step

Complete Laravel blog project step by step Part1

Laravel Blog Application from scratch


  • PHP 7.4
  • Laravel 8.x (PHP ≥ 7.3)
  • Bootstrap 4.x
  • Jquery 3.x
  • PhpmyAdmin 4.x

Frontend Features

  • Home page with all latest posts
  • Post Detail page with comment option
  • Right sidebar in all pages with
  • Search Option
  • 3 Recent Post
  • 3 popular post  (According to views)
  • 3 recent comments (with post link)
  • Create a setting for all those things
  • Guest Posting(Only Approved User can Post)
  • User Account Panel
  • Update Profile
  • Change Password
  • Forget Password
  • My Posts
  • My Comment
  • My Comments
  • About Us Page
  • Contact Us Page

 #Backend Feature

  • Admin Login
  • Manage Post Category
  • Manage Posts
  • Post Title dynamically
  • Post description dynamically
  • Category
  • Tags
  • Post-Thumbnail
  • Post Image
  • Manage Post comments (Approve or Disapprove)
  • Settings
  • Comment Auto approve or Not
  • User Auto Active or Not
  • Change Limit for recent posts, popular posts, recent comments

Let’s Start

  • Before start, I assumed you have already installed composer and all the pre requisites
  • Create a project using composer
composer create-project --prefer-dist laravel/laravel laravel-techblog
  • Once install the project go to the project folder and open it with any code editor. here I am using  Visual Studio
  • Run  php artisan serve

Now we will create HomeController and change the defult page

php artisan make:Controller HomeController

import HomeController in routes→web.php file

use App\Http\Controllers\HomeController;

set route for HomeController


Now we will create an index function, so we need to go Home controller and create a function index

 function index()
       return view('home');
  • Now we have to create a home.blade.php file in a resources→views folder
In this step, we simply load the view file with the help of controller

  • Now we will create models in laravel
  • #Data base Connectivity
  • connect with MySQL database
  • ##Database Table or Model (Database Tables)
  • User (Default Laravel Authentication System)
  • -name
  • -email
  • -password
  • – Category table
  • -title
  • -detail
  • -image
  • –Post table
  • -user(belongsTo relation)
  • -category (belongsTo relation)
  • -title
  • thumb image
  • fill mage
  • detail
  • tags(command separated tags)
  • –comments table
  • -user (belongsTo relation)
  • -post (belongsTo relation)
  • -comment

Let’s start 

  • open your PHPMyAdmin and create a database name blog

Link your database open .env file and configure as below


Change according to your database name username and password

Then run the below command

php artisan migrate


Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated:  2014_10_12_000000_create_users_table (118.10ms)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated:  2014_10_12_100000_create_password_resets_table (69.99ms)
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated:  2019_08_19_000000_create_failed_jobs_table (73.23ms)
Migrating: 2019_12_14_000001_create_personal_access_tokens_table
Migrated:  2019_12_14_000001_create_personal_access_tokens_table (117.59ms)

This command creates a table named users and table columns. and table columns already define in migration→


Now you can see your database has 5 tables 

Now we will create a Category model with the migration on the below command

php artisan make:model Category -m

-m flag will create migration

Once create the model you can see a table named 2021_10_15_090933_create_categories_table.php under the database→ migration→ and paste the below code.

 public function up()
        Schema::create('categories', function (Blueprint $table) {

Note:2021_10_15_090933 date-time will be charged as per your installation date time

php artisan migrate

Migrating: 2021_10_15_092124_create_categories_table
Migrated:  2021_10_15_092124_create_categories_table (66.59ms)

You can see categories table has been created with the columns which we had to define earlier

Note: if note required timestamp columns simply need to add code on the model

 protected $timestamp=false;
Model Name Category


namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Category extends Model
   use HasFactory;
   protected $timestamp=false;

Now similarly we will do Post and Comment Model

php artisan make:model Post -m

Go to the migration folder and open the newly created post table and paste the below code

 public function up()
       Schema::create('posts', function (Blueprint $table) {
php artisan migrate
php artisan make:model Comment -m
Model created successfully.
Created Migration: 2021_10_15_093715_create_comments_table

Go to the migration folder and open the newly created comments table and paste the below code

public function up()
       Schema::create('comments', function (Blueprint $table) {
php artisan migrate

Part 1 finished. please wait for part2



Leave a Reply

Your email address will not be published. Required fields are marked *