Issue
I am working in Laravel 5.0 app.
I have created route group like below,
Route::group(['prefix' => 'expert'], function () {
Route::get('dashboard', [
'as' => 'expert.dashboard',
'uses' => 'DashboardController@index'
]);
]);
I want to get the current route prefix in DashboardController
's index
method.
I dont know how to do that. I could not find this in documentation. Please help me.
Solution
You can do this two way
Type-hinting Request
in method
public function index(\Illuminate\Http\Request $request){
dd($request->route()->getPrefix());
}
or
public function index(){
dd($this->getRouter()->getCurrentRoute()->getPrefix());
}
I hope this helps.
Answered By - pinkal vansia
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.