title: Attempt to read property "name" on bool laravel 8, variable not transfering to view
body: <p>I keep encountering this error on Laravel 8 with PHP 8. Im grabbing the id from the view like so:</p>
  <pre><code>  &lt;button type=&quot;submit&quot;&gt;
       &lt;a href=&quot;{{route('employees.payslip', $employee-&gt;id)}}&quot; class=&quot;text-green-600 hover:text-green-900&quot;&gt;Payslip&lt;/a&gt;
    &lt;/button&gt;
  </code></pre>
  <p>This then goes to web.php like so:</p>
  <pre><code>Route::get('employees/{id}/payslip', ['App\Http\Controllers\PrintController', 'print'])-&gt;name('employees.payslip');
  </code></pre>
  <p>It then goes to the print function like so:</p>
  <pre><code>    public function print($id)
  {
      $employees = Employees::findOrFail($id);
      $teams = Team::all();
      return view('employees.payslip',compact('employees', 'teams'));
  }
  </code></pre>
  <p>When i remove the return view line and replace it with:</p>
  <pre><code>dd($employees);
  </code></pre>
  <p>It gives me the correct information but when i keep the line:</p>
  <pre><code>return view('employees.payslip',compact('employees', 'teams'));
  </code></pre>
  <p>and send it the view 'employees.payslip': it gives me the error: anyone has any ideas?</p>
  <pre><code>  @forelse($employees as $employee)
  &lt;tr&gt;
    &lt;td class=&quot;px-6 py-4 whitespace-nowrap text-sm text-gray-500&quot;&gt;
      {{$employee-&gt;name}}
    &lt;/td&gt;
    &lt;td class=&quot;px-6 py-4 whitespace-nowrap text-sm text-gray-500&quot;&gt;
      {{$employee-&gt;surname}}
    &lt;/td&gt;
    &lt;td class=&quot;px-6 py-4 whitespace-nowrap text-sm text-gray-500&quot;&gt;
      {{$employee-&gt;address}}
    &lt;/td&gt;
    &lt;td class=&quot;px-6 py-4 whitespace-nowrap text-sm text-gray-500&quot;&gt;
      {{$employee-&gt;phone}}
    &lt;/td&gt;
    &lt;td class=&quot;px-6 py-4 whitespace-nowrap text-sm text-gray-500&quot;&gt;
      {{$employee-&gt;role}}
    &lt;/td&gt;
    &lt;td class=&quot;px-6 py-4 whitespace-nowrap text-sm text-gray-500&quot;&gt;
      {{$employee-&gt;absent}}
    &lt;/td&gt;
  &lt;/tr&gt;
  @empty
    &lt;td&gt;
      No Information to Display
    &lt;/td&gt;
  @endforelse
  </code></pre>