I am using laravel 5.4, there is an error in the code below,
but there is no error when using laravel 5.3,
why is it?
controller:
public function index()
{
$user=\Auth::user();
$articles=$user->articles;
return view('index', compact('user','articles'));
}
view:
{{ $articles->count() }}
error:
Call to a member function count() on null
what should I do?