on-internet
← Community

How to restrict route access to certain ids

Stack Overflow ·

I need to restrict guest access to certain links like 'fixtures/1' and 'fixtures/2'. When a guest tries to access other ids, like 'fixtures/3' for example, they should get a message like "page not found". I tried like this: Route::get('/fixtures/{team}', function ($team) { // })->where($team, '1')->name('front.fixtures'); but it doesn't work. How I can add clause like this? Here is my route without any changes: Route::get('/fixture/{team}', 'FrontController@fixtures')->name('front.fixtures'); I tried to restrict access using if, but everytime I open page, it doesn't check the id. Here is my me

Comments

Sign in or sign up to comment and upvote.

No comments yet.