Support the ongoing development of Laravel.io →
Configuration Requests Database

i have travel website working with category and sub category EX: Link (1) : tours/egypt/cairo Link (2) : tours/uae/cairo

if you open link 1 you will get tours inside cairo if you change egypt to uae and with same city get the same tours

in DATABASE Egypt -cairo

UAE

  • not included cairo

i need if open link 2 get error page 404 and redirect me to home page

Route.php

Route::bind('toursection', function($id) { $toursection = \App\Models\TourSection::where('slug', $id)->first(); if (is_null($toursection)) App::abort(404, 'Page not found'); return $toursection; });

Route::bind('tourcategory', function($toursection, $id) { $tourcategory = \App\Models\TourCategory::where('slug', $toursection, $id)->first(); if (is_null($tourcategory)) App::abort(404, 'Page not found'); return $tourcategory; });

Route::get('tours/', 'Frontend\ToursController@index'); Route::get('tours/{toursection}', 'Frontend\ToursController@sectionIndex'); Route::get('tours/{toursection}/{tourcategory}', 'Frontend\ToursController@categoryIndex'); Route::get('tours/{toursection}/{tourcategory}/{slug}', 'Frontend\ToursController@show');

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

scopelinks scopelinks Joined 28 Dec 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.