質問

If I have the following defined:

in app/routes.php

Route::controller('prefix', 'MyClass@getMethod')

in app/controllers/MyClass.php

class MyClass {
  public function getMethod($param) {
    // ...
  }
}

The route that will be available is /prefix/method/{param}.

Is it possible change this to /prefix/{param}/method without explicitly defining the route and thus just keeping Route::controller?

Note: the change of order can be applied to all methods of the class.

Thanks

役に立ちましたか?

解決

Yes its possible to change order. Just edit the URI parameter at below

Your Routing :

Route::controller('prefix/{param}', 'MyController'); // Effects to All Controller Methods

OR

Route::controller('prefix/{param}', 'MyController@getMethod'); // Effects to specified Method

Keep the same controller. You don't need to change anyting.

The Result is /prefix/{param}/method

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top