gssj85's avatar
Level 1

Class "Route" not found on Breeze Blade Files

I have an API, it used to be just an API until I had to implement OAuth2, so I installed Passport and noticed the flow needed a stateful login, a server side rendered login page along with Passport built-in authorize code view so I installed Breeze.

However I'm having this error:

Class "Route" not found

In any blade file that uses the facade Route:

<body class="antialiased">

        <div class="relative flex items-top justify-center min-h-screen bg-gray-100 dark:bg-gray-900 sm:items-center py-4 sm:pt-0">

            @if (Route::has('login'))

                <div class="hidden fixed top-0 right-0 px-6 py-4 sm:block">

                    @auth

                        <a href="{{ url('/dashboard') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Dashboard</a>

                    @else

                        <a href="{{ route('login') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Log in</a>



                        @if (Route::has('register'))

                            <a href="{{ route('register') }}" class="ml-4 text-sm text-gray-700 dark:text-gray-500 underline">Register</a>

                        @endif

                    @endauth

                </div>

            @endif

What is strange is that I created a new project and installed Breeze and this doesn't happen, tried to compare the files and configs but couldn't find =/

0 likes
1 reply
maxxd's avatar

Sounds like the Route class hasn't been imported in the view. Try using Illuminate\Support\Facades\Route::has() instead.

Please or to participate in this conversation.