i need that guest's can access only to link 'fixtures/1' and 'fixtures/2'
when they manage to other id's, for exmpl 'fixtures/3' they should get something like "page not found"
i tryied like this:
Route::get('/fixtures/{team}', function ($team) {
//
})->where($team, '1')->name('front.fixtures');
but it doesn't worked. Can somebody help me, how i can add clause like this?
here is my route without any changes:
Route::get('/fixture/{team}', 'FrontController@fixtures')->name('front.fixtures');
EDITED:
I tryied to restrict with using if, but everytime i open page it doesn't check on id, here is my method:
public function fixtures(Request $request,Team $team = null) {
$matches = Match::where('home_team_id', $team->id)
->orWhere('away_team_id', $team->id)
->paginate(20);
$teams = Team::all();
$team = $request->route()->parameter('team');
if ($request->route('team') !== '1' || $request->route('team') !== '2') {
return view('front.fixtures')->with([
'matches' => $matches,
'teams' => $teams,
]);
} else {
abort('404');
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire