移动Laravel导致@IF语句错误

问题描述 投票:0回答:2

在移动我的项目之前,一切都很顺利。在我将它从我的电脑移到笔记本电脑后,我的@IF语句停止了工作。

例如,这是一段navbar.blade.php我的导航栏正在改变帐户类型,移动项目后,if命令不检查身份验证,所有用户都作为访客处理

@if(Auth::check())

              @if(Auth::user()->Account_type == 'Student')
            <li><a href="/myprojects">My projects</a></li>
              @ENDIF

              @if(Auth::user()->Account_type == 'Admin')
              <li><a href="/AdminDashboard">Dashboard</a></li>
               @ENDIF
@ENDIF

移动项目后,我尝试过

Composer Install
Composer Update
composer dumpautoload

没有什么对我有用

php laravel
2个回答
0
投票

试试这个:

@if (Auth::check())
    @if(Auth::user()->Account_type == 'Student')
        <li><a href="/myprojects">My projects</a></li>
    @endif

    @if(Auth::user()->Account_type == 'Admin')
        <li><a href="/AdminDashboard">Dashboard</a></li>
    @endif
@endif

0
投票

执行以下命令

composer install
                     or 
composer update

php artisan cache:clear 
php artisan view:clear 
php artisan config:clear 
composer dump-autoload

如果您使用的是Linux ubuntu,请在执行任何命令之前使用sudo。

© www.soinside.com 2019 - 2024. All rights reserved.