0

Sorry, anyone please help me. I use Laravel 5.4. I just wanna echo auth()-user()->role in view, but the result is different when I echo auth()->user()->role in controller. This is the code.

if(!empty(auth()->user())){
   echo auth()->user()->role;
}

result from controller

<li class="">
   <a href="#withdraw" data-toggle="tab" aria-expanded="false">
     <i class="material-icons">archive</i>
     Withdraw {{auth()->user()->role}}
     <div class="ripple-container"></div>
   </a>
</li>

result from view

The correct data is 3. Does anyone know the problem? I've tried to clear cache, but no changes. Thanks

Al-kadafi
  • 31
  • 1
  • 4

0 Answers0