For getting every new tutorial link Please join our telegram group

Part 2 laravel cms like wordpress project make a controller BaseController

This is laravel cms like wordpress project tutorial part 2 here we make a base controller for all front pages define.

In part 2 we will discuss these points.

  1. Make a controller BaseController
  2. Define web routes
  3. why we rename index.php to server.php
  4. Make a company page from theme

Command for make controller BaseController

php artisan make:controller BaseController

Routes define laravel 8 and after versions

Define our web routes in routes/web.php file. In web.php firstly use class name on the top section. Syntax of our route given in below code

Web.php
<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\BaseController;

Route::get('home', [BaseController::class,'home']);
Route::get('services', [BaseController::class,'services']);
BaseController
<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;

class BaseController extends Controller{
    public function home(){
       return "Home Page.";
    }

    public function services(){
       
    }
}

For detailed expelations watch the above video.

php laravel developer anmol sharma

Anmol Sharma

I am a software engineer and have experience in web development technologies like php, Laravel, Codeigniter, javascript, jquery, bootstrap and I like to share my deep knowledge by these blogs.

Related tutorial links