dimanche 27 janvier 2019

Laravel 5.4 route simplification

I've been trying to find some documentation on how to accomplish the following, but it seems like maybe I'm not using the correct search terms.

I would like to implement some simplified routes in Laravel 5.4 by omitting the route name from the path – for example:

  1. /{page} instead of /pages/{page}
  2. /profile instead of /users/{user}/edit
  3. /{exam}/{question} (or even /exams/{exam}/{question}) instead of /exams/{exam}/questions/{question}

Example of current routes

Route::resource('exams.questions', 'ExamQuestionController', ['only' => ['show']]);
// exams/{exam}/question/{question}

I know how to do this with route closures and one-off routes (e.g.: Route::get...) but is there a way to do this using Route::resource?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire