{"id":2588,"date":"2025-08-12T07:27:37","date_gmt":"2025-08-12T07:27:37","guid":{"rendered":"https:\/\/www.devopsconsulting.in\/blog\/?p=2588"},"modified":"2025-09-17T12:04:21","modified_gmt":"2025-09-17T12:04:21","slug":"a-complete-guide-to-laravel-12-rbac","status":"publish","type":"post","link":"https:\/\/www.devopsconsulting.in\/blog\/a-complete-guide-to-laravel-12-rbac\/","title":{"rendered":"A Complete Guide to Laravel 12 RBAC"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\" id=\"a-complete-guide-to-laravel-12-rbac-from-setup-to\"><strong>A Complete Guide to Laravel 12 RBAC: From Setup to Landing Page<\/strong><\/h1>\n\n\n\n<p>Welcome! This guide will walk you through building a complete Laravel 12 application with a robust Role-Based Access Control (RBAC) system. We&#8217;ll set up authentication and create three distinct user roles: <strong>Admin<\/strong>, <strong>Editor<\/strong>, and <strong>User<\/strong>. By the end, you&#8217;ll have a secure application with role-specific dashboards, a professional landing page, and the knowledge to troubleshoot common setup issues in modern Laravel.<\/p>\n\n\n\n<p>Let&#8217;s get started.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Set Up Your Laravel 12 Project<\/h2>\n\n\n\n<p>First, let&#8217;s create a fresh Laravel project. Open your terminal and run the following Composer command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">bash<code>composer create-project --prefer-dist laravel\/laravel laravel-rbac\n<\/code><\/pre>\n\n\n\n<p>Once the project is created, navigate into the directory:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cd laravel-rbac<br><\/code><\/pre>\n\n\n\n<p>Next, configure your database. Open the <code>.env<\/code> file in the root of your project and update the <code>DB_<\/code> variables with your local database credentials.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>DB_CONNECTION=mysql<br>DB_HOST=127.0.0.1<br>DB_PORT=3306<br>DB_DATABASE=laravel_rbac<br>DB_USERNAME=root<br>DB_PASSWORD=<br><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Add Authentication Scaffolding<\/h2>\n\n\n\n<p>Laravel makes it easy to set up login and registration systems. We&#8217;ll use the <code>laravel\/ui<\/code> package with Bootstrap.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>composer require laravel\/ui<br>php artisan ui bootstrap --auth<br>npm install<br>npm run dev<br><\/code><\/pre>\n\n\n\n<p>These commands generate all the necessary authentication views, routes, and controllers. Keep the <code>npm run dev<\/code> process running in a terminal to compile your assets as you work.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Implement Role-Based Access Control (RBAC)<\/h2>\n\n\n\n<p>Now, let&#8217;s build the core of our RBAC system. We&#8217;ll add a <code>role<\/code> column to our <code>users<\/code> table to manage permissions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create the Migration<\/h2>\n\n\n\n<p>Generate a migration to add the <code>role<\/code> column:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">bash<code>php artisan make:migration add_role_to_users_table --table=users\n<\/code><\/pre>\n\n\n\n<p>Open the new migration file in <code>database\/migrations\/<\/code> and modify the <code>up<\/code> method to add the column. We&#8217;ll set &#8216;user&#8217; as the default role.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php<code><em>\/\/ ...<\/em>\npublic function up(): void\n{\n    Schema::table('users', function (Blueprint $table) {\n        $table-&gt;string('role')-&gt;default('user'); <em>\/\/ Default role is 'user'<\/em>\n    });\n}\n<em>\/\/ ...<\/em>\n<\/code><\/pre>\n\n\n\n<p>Run the migration to update your database schema:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>php artisan migrate<br><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Create the Role Middleware<\/h2>\n\n\n\n<p>Middleware is perfect for protecting routes. Let&#8217;s create one to check a user&#8217;s role.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">bash<code>php artisan make:middleware RoleMiddleware\n<\/code><\/pre>\n\n\n\n<p>This creates <code>app\/Http\/Middleware\/RoleMiddleware.php<\/code>. Open it and update the <code>handle<\/code> method to check if the authenticated user has the required role.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>&lt;?php<br><br>namespace App\\Http\\Middleware;<br><br>use Closure;<br>use Illuminate\\Http\\Request;<br>use Illuminate\\Support\\Facades\\Auth;<br>use Symfony\\Component\\HttpFoundation\\Response;<br><br>class RoleMiddleware<br>{<br>    public function handle(Request $request, Closure $next, $role): Response<br>    {<br>        if (Auth::check() &amp;&amp; Auth::user()->role == $role) {<br>            return $next($request);<br>        }<br><br>        return redirect('\/home')->with('error', 'You do not have permission to access this page.');<br>    }<br>}<br><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Register the Middleware (The Laravel 12 Way)<\/h2>\n\n\n\n<p>In Laravel 11 and 12, middleware aliases are no longer registered in <code>app\/Http\/Kernel.php<\/code>. Instead, you register them in <strong><code>bootstrap\/app.php<\/code><\/strong>.<\/p>\n\n\n\n<p>Open <code>bootstrap\/app.php<\/code> and add your middleware alias inside the <code>withMiddleware()<\/code> method.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php<code>&lt;?php\n\nuse Illuminate\\Foundation\\Application;\nuse Illuminate\\Foundation\\Configuration\\Exceptions;\nuse Illuminate\\Foundation\\Configuration\\Middleware;\n\nreturn Application::configure(basePath: dirname(__DIR__))\n    -&gt;withRouting(\n        web: __DIR__.'\/..\/routes\/web.php',\n        commands: __DIR__.'\/..\/routes\/console.php',\n        health: '\/up',\n    )\n    -&gt;withMiddleware(function (Middleware $middleware) {\n        <em>\/\/ Register your 'role' middleware alias here<\/em>\n        $middleware-&gt;alias([\n            'role' =&gt; \\App\\Http\\Middleware\\RoleMiddleware::class,\n        ]);\n    })\n    -&gt;withExceptions(function (Exceptions $exceptions) {\n        <em>\/\/ ...<\/em>\n    })-&gt;create();\n<\/code><\/pre>\n\n\n\n<p>This is a critical step. Forgetting it will cause a <code>Target class [role] does not exist<\/code> error.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Define Role-Specific Routes<\/h2>\n\n\n\n<p>With the middleware registered, you can now protect routes in <code>routes\/web.php<\/code>. We&#8217;ll create separate dashboard routes for each role.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>use Illuminate\\Support\\Facades\\Route;<br>use App\\Http\\Controllers\\HomeController;<br>use App\\Http\\Controllers\\LandingPageController;<br><br><em>\/\/ Landing Page<\/em><br>Route::get('\/', [LandingPageController::class, 'index']);<br><br>Auth::routes();<br><br><em>\/\/ Home redirector<\/em><br>Route::get('\/home', [HomeController::class, 'index'])->name('home');<br><br><em>\/\/ Admin Routes<\/em><br>Route::middleware(['auth', 'role:admin'])->group(function () {<br>    Route::get('\/admin\/dashboard', function () {<br>        return view('admin.dashboard');<br>    })->name('admin.dashboard');<br>});<br><br><em>\/\/ Editor Routes<\/em><br>Route::middleware(['auth', 'role:editor'])->group(function () {<br>    Route::get('\/editor\/dashboard', function () {<br>        return view('editor.dashboard');<br>    })->name('editor.dashboard');<br>});<br><br><em>\/\/ User Routes<\/em><br>Route::middleware(['auth', 'role:user'])->group(function () {<br>    Route::get('\/user\/dashboard', function () {<br>        return view('user.dashboard');<br>    })->name('user.dashboard');<br>});<br><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Set Up Controllers and Views<\/h2>\n\n\n\n<h2 class=\"wp-block-heading\">Modify the RegisterController<\/h2>\n\n\n\n<p>Update the <code>RegisterController<\/code> at <code>app\/Http\/Controllers\/Auth\/RegisterController.php<\/code> to ensure new users are automatically assigned the &#8216;user&#8217; role.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><em>\/\/ ... in RegisterController.php<\/em><br>use App\\Models\\User;<br>use Illuminate\\Support\\Facades\\Hash;<br><br>protected function create(array $data)<br>{<br>    return User::create([<br>        'name' => $data['name'],<br>        'email' => $data['email'],<br>        'password' => Hash::make($data['password']),<br>        'role' => 'user', <em>\/\/ Automatically assign 'user' role<\/em><br>    ]);<br>}<br><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Modify the HomeController<\/h2>\n\n\n\n<p>The <code>HomeController<\/code> will act as a router after login, redirecting users to the correct dashboard based on their role. Open <code>app\/Http\/Controllers\/HomeController.php<\/code> and update the <code>index<\/code> method.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><em>\/\/ ... in HomeController.php<\/em><br>use Illuminate\\Support\\Facades\\Auth;<br><br>public function index()<br>{<br>    $role = Auth::user()->role;<br><br>    if ($role == 'admin') {<br>        return redirect()->route('admin.dashboard');<br>    } elseif ($role == 'editor') {<br>        return redirect()->route('editor.dashboard');<br>    } else {<br>        return redirect()->route('user.dashboard');<br>    }<br>}<br><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Create the Dashboard Views<\/h2>\n\n\n\n<p>Create the following Blade files for each role&#8217;s dashboard.<\/p>\n\n\n\n<p><strong>Admin Dashboard (<code>resources\/views\/admin\/dashboard.blade.php<\/code>):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>@extends('layouts.app')<br>@section('content')<br>&lt;div class=\"container\"><br>    &lt;div class=\"card\"><br>        &lt;div class=\"card-header\">{{ __('Admin Dashboard') }}&lt;\/div><br>        &lt;div class=\"card-body\">Welcome, Admin! You have full control.&lt;\/div><br>    &lt;\/div><br>&lt;\/div><br>@endsection<br><\/code><\/pre>\n\n\n\n<p><strong>Editor Dashboard (<code>resources\/views\/editor\/dashboard.blade.php<\/code>):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>@extends('layouts.app')<br>@section('content')<br>&lt;div class=\"container\"><br>    &lt;div class=\"card\"><br>        &lt;div class=\"card-header\">{{ __('Editor Dashboard') }}&lt;\/div><br>        &lt;div class=\"card-body\">Welcome, Editor! You can manage content.&lt;\/div><br>    &lt;\/div><br>&lt;\/div><br>@endsection<br><\/code><\/pre>\n\n\n\n<p><strong>User Dashboard (<code>resources\/views\/user\/dashboard.blade.php<\/code>):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>@extends('layouts.app')<br>@section('content')<br>&lt;div class=\"container\"><br>    &lt;div class=\"card\"><br>        &lt;div class=\"card-header\">{{ __('User Dashboard') }}&lt;\/div><br>        &lt;div class=\"card-body\">Welcome, User! This is your personal space.&lt;\/div><br>    &lt;\/div><br>&lt;\/div><br>@endsection<br><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 6: Build a Professional Landing Page<\/h2>\n\n\n\n<p>A great application needs a welcoming landing page. Let&#8217;s create one using Tailwind CSS for modern styling.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Create the Controller<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>php artisan make:controller LandingPageController<br><\/code><\/pre>\n\n\n\n<p>Add an <code>index<\/code> method to <code>app\/Http\/Controllers\/LandingPageController.php<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>public function index()<br>{<br>    return view('welcome');<br>}<br><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Create the Blade View<\/h2>\n\n\n\n<p>Replace the content of <code>resources\/views\/welcome.blade.php<\/code> with the following code. It includes a hero section, features, and a footer.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>&lt;!DOCTYPE html><br>&lt;html lang=\"{{ str_replace('_', '-', app()->getLocale()) }}\"><br>&lt;head><br>    &lt;meta charset=\"utf-8\"><br>    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><br>    &lt;title>Laravel RBAC Starter&lt;\/title><br>    &lt;link rel=\"preconnect\" href=\"https:\/\/fonts.bunny.net\"><br>    &lt;link href=\"https:\/\/fonts.bunny.net\/css?family=instrument-sans:400,500,600,700\" rel=\"stylesheet\" \/><br>    @vite(['resources\/sass\/app.scss', 'resources\/js\/app.js'])<br>&lt;\/head><br>&lt;body class=\"bg-gray-50 text-gray-800 antialiased\"><br>    &lt;div class=\"relative min-h-screen flex flex-col items-center justify-center\"><br>        <em>&lt;!-- Header --><\/em><br>        &lt;header class=\"w-full max-w-7xl mx-auto px-6 lg:px-8 absolute top-0 pt-6\"><br>            @if (Route::has('login'))<br>                &lt;nav class=\"flex items-center justify-end gap-4\"><br>                    @auth<br>                        &lt;a href=\"{{ url('\/home') }}\" class=\"rounded-md px-3 py-2 text-black ring-1 ring-transparent transition hover:text-black\/70 focus:outline-none focus-visible:ring-[#FF2D20]\">Dashboard&lt;\/a><br>                    @else<br>                        &lt;a href=\"{{ route('login') }}\" class=\"rounded-md px-3 py-2 text-black ring-1 ring-transparent transition hover:text-black\/70 focus:outline-none focus-visible:ring-[#FF2D20]\">Log in&lt;\/a><br>                        @if (Route::has('register'))<br>                            &lt;a href=\"{{ route('register') }}\" class=\"rounded-md px-3 py-2 text-black ring-1 ring-transparent transition hover:text-black\/70 focus:outline-none focus-visible:ring-[#FF2D20]\">Register&lt;\/a><br>                        @endif<br>                    @endauth<br>                &lt;\/nav><br>            @endif<br>        &lt;\/header><br><br>        <em>&lt;!-- Main Content --><\/em><br>        &lt;main class=\"w-full max-w-7xl mx-auto px-6 lg:px-8 text-center py-20\"><br>            &lt;h1 class=\"text-4xl font-bold tracking-tight text-gray-900 sm:text-6xl\">Your App with Role-Based Access&lt;\/h1><br>            &lt;p class=\"mt-6 text-lg leading-8 text-gray-600\">A robust starting point for your next Laravel project, complete with authentication and pre-configured user roles.&lt;\/p><br>            &lt;div class=\"mt-10 flex items-center justify-center gap-x-6\"><br>                &lt;a href=\"{{ route('register') }}\" class=\"rounded-md bg-indigo-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500\">Get Started&lt;\/a><br>                &lt;a href=\"#features\" class=\"text-sm font-semibold leading-6 text-gray-900\">Learn more &lt;span aria-hidden=\"true\">\u2192&lt;\/span>&lt;\/a><br>            &lt;\/div><br>        &lt;\/main><br>        <br>        <em>&lt;!-- Footer --><\/em><br>        &lt;footer class=\"w-full text-center py-8 text-sm text-gray-500\"><br>            &lt;p>Laravel v{{ Illuminate\\Foundation\\Application::VERSION }} (PHP v{{ PHP_VERSION }})&lt;\/p><br>        &lt;\/footer><br>    &lt;\/div><br>&lt;\/body><br>&lt;\/html><br><\/code><\/pre>\n\n\n\n<p><em>Note: This landing page assumes you have <strong>Tailwind CSS<\/strong> installed. If you used <code>laravel\/ui bootstrap<\/code>, the styling might differ. You can install Tailwind by following the official Laravel documentation.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 7: Testing and Final Touches<\/h2>\n\n\n\n<p>To test your roles, you&#8217;ll need to manually update a user&#8217;s role in the database.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Register a new user (they will have the &#8216;user&#8217; role).<\/li>\n\n\n\n<li>Use a database client like phpMyAdmin or Sequel Ace to change their <code>role<\/code> in the <code>users<\/code> table to <code>admin<\/code> or <code>editor<\/code>.<\/li>\n\n\n\n<li>Log in as that user. You should be redirected to the correct dashboard.<\/li>\n<\/ol>\n\n\n\n<p>Congratulations! You now have a fully functional Laravel 12 application with authentication and a multi-tiered RBAC system. This starter project is the perfect foundation for building complex, secure web applications.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A Complete Guide to Laravel 12 RBAC: From Setup to Landing Page Welcome! This guide will walk you through building [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2588","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>A Complete Guide to Laravel 12 RBAC - DevOps Consulting<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.devopsconsulting.in\/blog\/a-complete-guide-to-laravel-12-rbac\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"A Complete Guide to Laravel 12 RBAC - DevOps Consulting\" \/>\n<meta property=\"og:description\" content=\"A Complete Guide to Laravel 12 RBAC: From Setup to Landing Page Welcome! This guide will walk you through building [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.devopsconsulting.in\/blog\/a-complete-guide-to-laravel-12-rbac\/\" \/>\n<meta property=\"og:site_name\" content=\"DevOps Consulting\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-12T07:27:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-17T12:04:21+00:00\" \/>\n<meta name=\"author\" content=\"Abhishek Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Abhishek Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.devopsconsulting.in\/blog\/a-complete-guide-to-laravel-12-rbac\/\",\"url\":\"https:\/\/www.devopsconsulting.in\/blog\/a-complete-guide-to-laravel-12-rbac\/\",\"name\":\"A Complete Guide to Laravel 12 RBAC - DevOps Consulting\",\"isPartOf\":{\"@id\":\"https:\/\/www.devopsconsulting.in\/blog\/#website\"},\"datePublished\":\"2025-08-12T07:27:37+00:00\",\"dateModified\":\"2025-09-17T12:04:21+00:00\",\"author\":{\"@id\":\"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/fc397ba8be42f9fdd53450edfc73006f\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.devopsconsulting.in\/blog\/a-complete-guide-to-laravel-12-rbac\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.devopsconsulting.in\/blog\/#website\",\"url\":\"https:\/\/www.devopsconsulting.in\/blog\/\",\"name\":\"DevOps Consulting\",\"description\":\"DevOps Consulting | SRE Consulting | DevSecOps Consulting | MLOps Consulting\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.devopsconsulting.in\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/fc397ba8be42f9fdd53450edfc73006f\",\"name\":\"Abhishek Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g\",\"caption\":\"Abhishek Singh\"},\"description\":\"I\u2019m Abhishek, a DevOps, SRE, DevSecOps, and Cloud expert with a passion for sharing knowledge and real-world experiences. I\u2019ve had the opportunity to work with Cotocus and continue to contribute to multiple platforms where I share insights across different domains: \u2022 DevOps School \u2013 Tech blogs and tutorials \u2022 Holiday Landmark \u2013 Travel stories and guides \u2022 Stocks Mantra \u2013 Stock market strategies and tips \u2022 My Medic Plus \u2013 Health and fitness guidance \u2022 TrueReviewNow \u2013 Honest product reviews \u2022 Wizbrand \u2013 SEO and digital tools for businesses I\u2019m also exploring the fascinating world of Quantum Computing.\",\"url\":\"https:\/\/www.devopsconsulting.in\/blog\/author\/abhishek\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"A Complete Guide to Laravel 12 RBAC - DevOps Consulting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.devopsconsulting.in\/blog\/a-complete-guide-to-laravel-12-rbac\/","og_locale":"en_US","og_type":"article","og_title":"A Complete Guide to Laravel 12 RBAC - DevOps Consulting","og_description":"A Complete Guide to Laravel 12 RBAC: From Setup to Landing Page Welcome! This guide will walk you through building [&hellip;]","og_url":"https:\/\/www.devopsconsulting.in\/blog\/a-complete-guide-to-laravel-12-rbac\/","og_site_name":"DevOps Consulting","article_published_time":"2025-08-12T07:27:37+00:00","article_modified_time":"2025-09-17T12:04:21+00:00","author":"Abhishek Singh","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Abhishek Singh","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.devopsconsulting.in\/blog\/a-complete-guide-to-laravel-12-rbac\/","url":"https:\/\/www.devopsconsulting.in\/blog\/a-complete-guide-to-laravel-12-rbac\/","name":"A Complete Guide to Laravel 12 RBAC - DevOps Consulting","isPartOf":{"@id":"https:\/\/www.devopsconsulting.in\/blog\/#website"},"datePublished":"2025-08-12T07:27:37+00:00","dateModified":"2025-09-17T12:04:21+00:00","author":{"@id":"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/fc397ba8be42f9fdd53450edfc73006f"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.devopsconsulting.in\/blog\/a-complete-guide-to-laravel-12-rbac\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.devopsconsulting.in\/blog\/#website","url":"https:\/\/www.devopsconsulting.in\/blog\/","name":"DevOps Consulting","description":"DevOps Consulting | SRE Consulting | DevSecOps Consulting | MLOps Consulting","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.devopsconsulting.in\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/fc397ba8be42f9fdd53450edfc73006f","name":"Abhishek Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.devopsconsulting.in\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/790feefe779852cdf344ca7318bf6c13832223c9b3c6bf4d217658412041026d?s=96&d=mm&r=g","caption":"Abhishek Singh"},"description":"I\u2019m Abhishek, a DevOps, SRE, DevSecOps, and Cloud expert with a passion for sharing knowledge and real-world experiences. I\u2019ve had the opportunity to work with Cotocus and continue to contribute to multiple platforms where I share insights across different domains: \u2022 DevOps School \u2013 Tech blogs and tutorials \u2022 Holiday Landmark \u2013 Travel stories and guides \u2022 Stocks Mantra \u2013 Stock market strategies and tips \u2022 My Medic Plus \u2013 Health and fitness guidance \u2022 TrueReviewNow \u2013 Honest product reviews \u2022 Wizbrand \u2013 SEO and digital tools for businesses I\u2019m also exploring the fascinating world of Quantum Computing.","url":"https:\/\/www.devopsconsulting.in\/blog\/author\/abhishek\/"}]}},"_links":{"self":[{"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/posts\/2588","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/comments?post=2588"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/posts\/2588\/revisions"}],"predecessor-version":[{"id":2685,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/posts\/2588\/revisions\/2685"}],"wp:attachment":[{"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/media?parent=2588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/categories?post=2588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsconsulting.in\/blog\/wp-json\/wp\/v2\/tags?post=2588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}