Home > other >  Laravel Route not defined breeze
Laravel Route not defined breeze

Time:07-26

I have a weird situation, where my route seems to be not defined.

I am using Laravel's starter kit Breeze, and I am adding top left navigational links. This is my 4th link already, but it seems that It's the first time I face such issue.

Controller:

public function index(Request $request)
    {
        $user = $request->user();
        $data = $user->campaigns;
        return view('subscribes.index', ['data' => $data]);
    }

Route:

Route::resource('/my_campaigns', App\Http\Controllers\SubscribeController::class);

Navigational link code:

 <div >
                    <x-nav-link :href="route('subscribes.index')" :active="request()->routeIs('subscribes.index')">
                        {{ __('My Campaigns') }}
                    </x-nav-link>
                </div>

Error message:

Route [subscribes.index] not defined.

I have spent 2 hours trying to check every single spot, where the issue may lay, but to no avail. I have already cleared route:cache.

I'd like to note, that the page /my_campaigns opens without any issues, and is working, until I try to add it within the navigational links.

My folders and files seems to be created correct as well, due to the fact, that /my_campaigns is working.

Any idea, where I missed something?

CodePudding user response:

The issue was within my navigational link code. Where the href route is defined, I have used incorrect URL, therefore, this issue was caused.

  • Related