dimanche 26 août 2018

Can I create a resource route with {store}/products?

Route::resource('products', 'ProductsController');

so I have this route in the meantime, and I want to change it to

Route::resource('{store}/products', 'ProductsController', [
        function($store) {
            $store = App\Models\Store::where('slug', $store)->firstOrFail();
        }
    ]);

is this correct? what would my controller functions look like? should I add $store in each functions I am going to use?

or should I do the long way where I have to do it like Route::get, Route::post...



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2LoQTEQ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire