how to add a link to the admin page in the default welcome.blade.php in laravel 8

I’ve made an isAdmin middleware to check if the user is the admin, what I’m I doing wrong? The code for welcome.blade.php

    <div class="">
        @if (Route::has('login'))
        <div class="">
            <a href="{{ url('/home') }}" class="">Home</a>
            <a href="{{ url('/admin-view') }}" class="">Admin View</a>
            <a href="{{ route('login') }}" class="">Log in</a>

            @if (Route::has('register'))
            <a href="{{ route('register') }}" class="ml-4 ">Register</a>

it’s just printing @isadmin instead of checking if the user is the admin.


You can check it this way

@if(Auth::user()->role === "admin")

Of course assuming you have an attribute role in your User model. Middlewares are used to deal with HTTP requests.