title: Laravel AUTH with Guard Show Logged in User credentials
body: <p>I'm Having Problem with my multi Auth Laravel application. I am trying to login my admin user with a guard which is admin,   <code>{{ auth()-&gt;user()-&gt;username }}</code> this is the code that im using to show the logged in user username it works fine but when i put it on my admin dashboard it gives me error </p>
  
  <p>This is the error i got</p>
  
  <blockquote>
      "Trying to get property 'name' of non-object (View: C:\xampp\htdocs\Projects\centralsocialv2.4\resources\views\admindashboard.blade.php)"</blockquote>
  
  <p>This is my <code>Admin.php</code></p>
  
  <pre><code>class Admin extends Authenticatable
  {
      use Notifiable;
  
      protected $guard = 'admin';
  
      protected $table = 'admins';
  
  
      protected $fillable = [
        'username', 'password',
  ];
  
  /**
   * The attributes that should be hidden for arrays.
   *
   * @var array
   */
  protected $hidden = [
      'password', 'remember_token',
  ];
  }
  </code></pre>
  
  <p>This is what handles my Admin Login on <code>AdminController.php</code></p>
  
  <pre><code>public function adminlogin(Request $request)
  {
  
         // Validation 
         $this-&gt;validate($request, [
          'username' =&gt; 'required',
          'password' =&gt; 'required'
    ]);
  
  
  
    $username = $request-&gt;input('username');
    $password = $request-&gt;input('password');
  
    if (Auth::guard('admin')-&gt;attempt(['username' =&gt; $username, 'password' =&gt; $password]))
    {
     return view('admindashboard');;
    }
     return ('Nope');
  
  }
  </code></pre>
  
  <p>My Dashboard view where admin redirects if logged in</p>
  
  <pre><code>&lt;h1&gt; Hi there   {{ Auth::user()-&gt;name }}   you are logged in as Admin 
  &lt;/h1&gt; 
  
  @if (!Auth::guard('admin')-&gt;check())
  no admin
  @else
  yes admin
  @endif
  
  &lt;a href="{{ route('userlogout') }}" &gt; Log out &lt;/a&gt;
  </code></pre>
  
  <p>Something wrong with my Code? Thank you guys!</p>