Laravel: Load method in another controller without changing the url

前端 未结 4 1464
清歌不尽
清歌不尽 2020-12-07 21:20

I have this route: Route::controller(\'/\', \'PearsController\'); Is it possible in Laravel to get the PearsController to load a method from another controller

4条回答
  •  渐次进展
    2020-12-07 21:51

    if you were in AbcdController and trying to access method public function test() which exists in OtherController you could just do:

    $getTests = (new OtherController)->test();
    

    This should work in L5.1

提交回复
热议问题