Implement the Auth Class to the php file in laravel -


i want details of logged in user's name

<?php echo auth::user()->name; ?>

inside php file.

the php file under views/layouts/profile.php

i tried include inside profile.php make auth class available.

<?php namespace app\http\controllers; require '../../../vendor/autoload.php'; use auth; ?> 

the autoload.php file loaded in properly. still getting error fatal error: class 'auth' not found error in profile.php.

how can make available ?

put use auth in respective controller.see dont need add use auth in view file , there no need add autolaod.php.

then use <?php echo auth::user()->name; ?> in profile.php.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -