4 months ago

Laravel multiple slugs

Posted 4 months ago by keizah

I am wondering how I can create N slugs in route. For example, I have Category model.

// web.php
Route::get('/ads/{categories}', '[email protected]');

How I can achieve the result of: http://localhost/ads/transport/cars/bmw/3rd-class/330/diesel/i-am-solding-my-bmw ?

I don't want to use any packages, just thinking about how I can do this with Route Service provider?

I can do what I want with example below, but I want more efficient way

Route::get('/ads/{slug1}/{slug2}/{slug3}', '[email protected]'); //and so on..

maybe laravel has a solution to get array in one slug? I need your help guys. Thanks

Please sign in or create an account to participate in this conversation.