Home / Snippets / Laravel Check if Route Exists
Laravel Check if Route Exists cover

Laravel Check if Route Exists

5.1K

3 years ago

0 comments

To check if the route exists in Laravel, you can make use of the "Route::has('route.name')" method. By checking if route exists using this method, you will be able to perform certain logic that works like below.
@if (Route::has('password.request'))
    <a class="text-sm text-gray-800 dark:text-gray-400 hover:text-blue-500 dark:hover:text-blue-500" href="{{ route('password.request') }}">
        {{ __('Forgot your password?') }}
    </a>
@endif

To get the inverse you can use the exclamation mark to reverse the value.
@if (! Route::has('password.request'))
    // your code here
@endif
notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this