在 null 上调用成员函数 Manages()
                
                    
                         
                        
                            
                                P粉818306280
                                2023-08-26 14:11:08
                            
                                                        [PHP讨论组]
                                                     
                     
                    
                 
             
            
            
                <p>资源/视图/布局/navigation.blade.php: 8需要</p>
<p>在我的主页 Laravel</p>
<pre class="brush:php;toolbar:false;"><!-- 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></pre>
<p>和我的布局导航</p>
<p>我在这一行有错误:@if (auth()->user()->manages())</p>
<p>在 null 上调用成员函数 Manages()</p>
<p>扩展供应商框架资源/视图/布局/navigation.blade.php: 8需要9个供应商框架资源/视图/welcome.blade.php: 10需要56个供应商框架public/index.php: 51 require_once 1个供应商框架< /p>            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
         
        
        
     
这意味着您没有经过身份验证的用户,因此首先检查
auth()->user()是否存在,例如:@if (!is_null(auth()->user())) //if auth()->user() is not null, you can call the manages() function on it @if(auth()->user()->manages()) //content you want @endif @endif