【问题标题】:Moving Laravel causing @IF statement error移动 Laravel 导致 @IF 语句错误
【发布时间】:2019-02-28 19:57:27
【问题描述】:

在移动我的项目之前,一切都很好。在我将它从我的电脑移到笔记本电脑后,我的 @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

没有什么对我有用

【问题讨论】:

  • 清除缓存后再试
  • @ENDIF更改为@endif
  • 使用Auth::user()-&gt;Account_type === 'Student'
  • @Davit 逻辑没有问题,它在我的电脑上运行
  • @Shibon 很遗憾没用

标签: php laravel


【解决方案1】:

试试这个:

@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

【讨论】:

  • 你是怎么做到的?我的解决方案对你有用吗?
【解决方案2】:

执行以下命令

composer install
                     or 
composer update

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多