resources / views / layouts / navigation.blade .php : 8 require
in my home page Laravel
<!-- resources/views/page.blade.php -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Front Page</title>
</head>
<body>
<!-- Include the navigation menu -->
@include('layouts.navigation')
<!-- Your front page content goes here -->
<h1>Welcome to the front page</h1>
<p>This is the content of your front page.</p>
</body>
</html>
and my layout navigation
i have error in this line : @if (auth()->user()->manages())
Call to a member function manages() on null
Expand vendor frames resources / views / layouts / navigation.blade .php : 8 require 9 vendor frames resources / views / welcome.blade .php : 10 require 56 vendor frames public / index .php : 51 require_once 1 vendor frame
2
Answers
That means, you dont have an authenticated user, so check first if
auth()->user()
exists, like:You can use the optional helper from laravel.
It allows you to call methods or access properties off of objects, if the object is
null
, instead of throwing an error,null
is returned ie;