Support the ongoing development of Laravel.io →
Authentication Views Blade
Last updated 2 years ago.
0

You could use Auth facade in your controller or view to choose which view to use/extend.

For examle, in controller:

public function show($id) 
{
    // ...
    if ( \Auth::user()->isAdmin() )
        return view('articles.adminshow');
    } else {
        return view('articles.show');
    }
}

You'll also need to implement isAdmin() method in your App/User class.

In a view this would look like this:

@if ( \Auth::user()->isAdmin() )
    @extends('admin-app')
@else
    @extends('app')
@endif
Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ocraton ocraton Joined 18 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.