Question

In my application I have used laravel Auth Class for Authentication. I am not able to use

  Auth::check or Auth::user()->name 

or any method of Auth in my view. but I can access it in controller. works fine on my local server but on hosting server it's not working. Is there problem with configuration? I stuck with these for 2 days. I don't know what to do.

My portion of view is below. It works everything fine on local server.

   <div class="ribbon">
            <nav>
                @if(Auth::check())
                <ul class="profile-nav">
                    <li class="active"><a href="#" title="Dashboard">Hi, {{Auth::user()->name}}</a></li>                                                                                    
                </ul>
                <ul class="profile-nav">                                                
                    <li class="active"><a href="/dashboard" title="Dashboard">Dashboard</a></li>                    
                </ul>   
                <ul class="profile-nav">
                    <li class="active"><a href="/logout" title="Logout">Logout</a></li>                         
                </ul>                       
                @else
                <ul><li class="active"><a href="#" title="Dashboard">Hi, Guest</a></li>                                         
                </ul>
                <ul>                                        
                    <li class="active"><a href="#" id="showlogin" title="Login">Login</a></li>              

                </ul>
                <ul>                
                    <li class="active"><a href="#" id="showreg" title="Settings">Register</a></li>
                </ul>
                @endif

            </nav>
        </div>

Pas de solution correcte

Autres conseils

Finally i got it.

I was Extending Eloquent in BaseModel and then i was extening BaseModel in my user model. so was not able to Access any protected properties like primaryKey. I trick it and now it works. Thanks for comments and suggestions guys.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top