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
Post a Comment