
step:1– first, you have go this path: C:\xampp\htdocs. then you have right-click on the git base here. same as this pic.
Step:2- write any project name like that.

Step:3– composer create-project –prefer-dist laravel/laravel tutrial
Strep:3– and press the Enter .it will take a few minutes for installing this project.
Step:4– edit .env file and put your database name credentials in it.

Step:5- go to your users’ table migration file and add one more field called isAdmin, and its data type is boolean.
Step:6- Now run the following command. php artisan migrate
Step:7- The next step is to create Authentication functionality. php artisan make:auth
it will be shown: So the auth scaffold will generate successfully.
Step:8-just write php artisan serve and press enter than go this url: http://127.0.0.1:8000/
Step:9- Create one middleware by typing following Laravel Command.
Step:10- go to this directory. app >> Http >> middleware >> admin.php
/* | |
* Handle an incoming request. | |
* | |
* @param \Illuminate\Http\Request $request | |
* @param \Closure $next | |
* @return mixed | |
*/ | |
public function handle($request, Closure $next) | |
{ | |
if(auth()->user()->isAdmin == 1){ | |
return $next($request); | |
} | |
return redirect('home')->with('error','You have not admin access'); | |
} |
Step:11- you have to go this path : app >> Http >> Kernel.php
<?php | |
protected $routeMiddleware = [ | |
'auth' => \Illuminate\Auth\Middleware\Authenticate::class, | |
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, | |
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, | |
'can' => \Illuminate\Auth\Middleware\Authorize::class, | |
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, | |
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, | |
'admin' => \App\Http\Middleware\Admin::class, | |
]; |
Step:12- you have added our custom middleware called admin.
<?php | |
Route::get('admin/routes', 'HomeController@admin')->middleware('admin'); |
Step:13-you have to resources>>view>>home.blade.php
@extends('layouts.app') | |
@section('content') | |
<div class="container"> | |
@if(\Session::has('error')) | |
<div class="alert alert-danger"> | |
{{\Session::get('error')}} | |
</div> | |
@endif | |
<div class="row"> | |
<div class="col-md-8 col-md-offset-2"> | |
<div class="panel panel-default"> | |
<div class="panel-heading">Dashboard</div> | |
<div class="panel-body"> | |
<a href="{{url('admin/routes')}}">Admin</a> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
@endsection |
Step:14- you have to HomeController.
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
class HomeController extends Controller | |
{ | |
/** | |
* Show the application dashboard. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function index() | |
{ | |
return view('home'); | |
} | |
public function admin() | |
{ | |
return view('admin'); | |
} | |
} |
Step:15– Create one admin.blade.php
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>ADMIN PAGE</title> | |
</head> | |
<body> | |
WELCOME TO ADMIN ROUTE | |
</body> | |
</html> |
Step:16-than you have to go into a database.
and run this command php artisan serve. and go on url: http://127.0.0.1:8000/



MotoShare.in is your go-to platform for adventure and exploration. Rent premium bikes for epic journeys or simple scooters for your daily errands—all with the MotoShare.in advantage of affordability and ease.