title: Trying to get property of non-object (View: C:\Program Files\Ampps\www\films\resources\views\home.blade.php)
body: <p>I have an error with <code>Auth:: user()-&gt;name</code> and if I remove this div and run with table codes the error is same. Here is home.blade.php. I run the same code on another app it worked but not on this. </p>
  
  <pre><code>@extends('layouts.app')
  @section('content')
  &lt;div class="container"&gt;
  
    &lt;div class="card"&gt;
      &lt;div class="card-header bg-dark text-light"&gt;
        &lt;h5 class="card-title"&gt;User dashboard for {{Auth::user()-&gt;name}}&lt;/h5&gt;
  
        &lt;a href="#" class="btn btn-danger" role="Button" style="float:right"&gt;Settings&lt;/a&gt;
  
      &lt;/div&gt;
      &lt;div class="card-body"&gt;
        &lt;div class="row"&gt;
          &lt;div class="col-md-8"&gt;
            &lt;table class="table table-striped"&gt;
              &lt;tbody&gt;
                &lt;tr&gt;
                  &lt;th&gt;Movies you've rated &lt;/th&gt;
                  &lt;td&gt;{{Auth::user()-&gt;ratings-&gt;count()}}&lt;/td&gt;
                &lt;/tr&gt;
                  &lt;tr&gt;
                    &lt;th&gt;Movies you've rated&lt;/th&gt;
                    &lt;td&gt;&lt;ul&gt;
                      @foreach(Auth::user()-&gt;ratings as $rating)&lt;li&gt;{{$rating-&gt;movie-&gt;title}} (rating {{$rating-&gt;rating}} /5)&lt;/li&gt;
                      @endforeach
                    &lt;/ul&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/tbody&gt;
            &lt;/table&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;a href="{{route('movies.index')}}" class="btn btn-danger" role="Button"&gt;Back&lt;/a&gt;
    &lt;/div&gt;
  
  @endsection
  </code></pre>