Online Snippets Library

Two different view for single URI In Laravel

In below example,we will call two different view for single URI.

Example

Route::get('/dashboard', array('before'=> 'auth','as' => 'dashboard',function()
    {
        if (@Auth::user()->employee)
    {
        return App::make('DashboardController')->employeeDashboard();
    }
    else
    {
        return App::make('DashboardController')->adminDashboard();
    }             
}
));