Reputation: 35
I want to load the panel if the user is logged in
and if the client is the master
But both files are loaded at runtime.
It does not run like a bet!
@if(Auth::check())
@extends('panel')
@else
@extends('master')
@endif
Upvotes: 1
Views: 72
Reputation: 21681
You should try this:
@extends(isset(Auth::user()->id) ? 'panel' : 'master');
Upvotes: 0
Reputation: 11340
What do you want? To have different layouts for logged user and not logged one?
@extends(Auth::check() ? 'panel' : 'master')
You can't use two extends.
Two extends generate compiled views with code
<?php if(Auth::check()): ?>
<?php else: ?>
<?php endif; ?>
You can see, that extends are not here. But in the end of it -
<?php echo $__env->make('panel')... ->render();
<?php echo $__env->make('master')... ->render();
That's why use see them both.
Upvotes: 2
Reputation: 1369
Edit your extends definition :
Try this
@extends(auth()->check() ? 'panel' : 'master')
Upvotes: 0
Reputation:
Try use:
auth()->check(), \Auth::check(),
or remove all views in /var/www/html/laravel-master/storage/framework/views/
.
If Auth::check() does not work, use Illuminate\Support\Facades\Auth::check() instead:
@if(Illuminate\Support\Facades\Auth::check())
@extends('panel')
@else
@extends('master')
@endif
Upvotes: 0