如何解决 Laravel 上的 ErrorException

How can I resolve ErrorException on Laravel

我已经将 Laravel 应用程序从一台服务器迁移到另一台服务器,但在新服务器上它会抛出如下错误: 注意:它在共享主机上。

ErrorException in dad68dc02a27f7285385d1802abef8de21c58892.php line 126: Trying to get property 'designer' of non-object (View: /home/username/orders.example.com/appz/resources/views/layouts/gentella.blade.php) (View: /home/username/orders.example.com/appz/resources/views/layouts/gentella.blade.php)

以下是我的看法:

<div class="container body" style="width: 100% !important;padding: 0px !important;">


<div class="main_container">

  <div class="col-md-3 left_col">
    <div class="left_col scroll-view">

      <div class="navbar nav_title" style="border: 0;">
        <a href="{{ URL::to($navbar_menu->url) }}" class="site_title"><i class="fa fa-paw"></i> <span>{{ $navbar_menu->label }}</span></a>
      </div>
      <div class="clearfix"></div>

      <!-- menu prile quick info -->
      <div class="profile">
        <div class="profile_pic">
          <img height="" src="@if(@Auth::user()->image) {{ URL::to(Auth::user()->image) }} @else {{ URL::to('images/img.png') }} @endif" alt="..." class="img-circle profile_img">
        </div>
        <div class="profile_info row">
          <span>Welcome,</span>
          @if(Auth::user())
            <h2>{{ Auth::user()->name }}</h2>
            @else
            <h2>Guest</h2>
          @endif

        </div>
      </div>
      <!-- /menu prile quick info -->

      <br />

      <!-- sidebar menu -->
      <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">

        <div class="menu_section">
          <h3>General</h3>
          <ul class="nav side-menu">
            @foreach($menus as $menu)
              @if($menu->type=='single' && @$menu->allow_writer != 'no')
                @if($www->gentella == 1)
                  <?php
                  $real_label = strtolower($menu->menus->label);
                  $real_label = str_replace('orders','projects',$real_label);
                  $design_label = ucwords($real_label);
                  ?>
                  <li>
                    <a href="{{ URL::to($menu->menus->url)  }}"><i class="fa {{ $menu->menus->icon }}"></i> {{ $design_label }}&nbsp;&nbsp;&nbsp;<span class="" id="{{ @$menu->slug }}"></span></a>
                  </li>
                @else
                  <li>
                    <a href="{{ URL::to($menu->menus->url)  }}"><i class="fa {{ $menu->menus->icon }}"></i> {{ $menu->menus->label }}&nbsp;&nbsp;&nbsp;<span class="" id="{{ @$menu->slug }}"></span></a>
                  </li>
                  @endif
              @endif

              @if($menu->type=='many')
                  <li><a><i class="fa {{ $menu->icon }}"></i> {{ $menu->label }} <span class="fa fa-chevron-down"></span></a>
                    <ul class="nav child_menu" style="display: none">
                      @foreach($menu->menus as $drop)
                        @if($drop->label)
                        <li><a href="{{ URL::to($drop->url) }}">{{ $drop->label }}</a><li>
                        @endif
                      @endforeach
                    </ul>
                  </li>
              @endif
            @endforeach
          </ul>
        </div>

      </div>
      <!-- /sidebar menu -->

      <!-- /menu footer buttons -->
      {{--<div class="sidebar-footer hidden-small">--}}
        {{--<a data-toggle="tooltip" data-placement="top" title="Settings">--}}
          {{--<span class="glyphicon glyphicon-cog" aria-hidden="true"></span>--}}
        {{--</a>--}}
        {{--<a data-toggle="tooltip" data-placement="top" title="FullScreen">--}}
          {{--<span class="glyphicon glyphicon-fullscreen" aria-hidden="true"></span>--}}
        {{--</a>--}}
        {{--<a data-toggle="tooltip" data-placement="top" title="Lock">--}}
          {{--<span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span>--}}
        {{--</a>--}}
         {{--<a href="{{ URL::to('logout') }}" data-placement="top" title="Logout">--}}
          {{--<span class="glyphicon glyphicon-off" aria-hidden="true"></span>--}}
        {{--</a>--}}
      {{--</div>--}}
      <!-- /menu footer buttons -->
    </div>
  </div>

  <!-- top navigation -->
  <div class="top_nav">

    <div class="nav_menu">
      <nav class="" role="navigation">
        <div class="nav toggle">
          <a id="menu_toggle"><i class="fa fa-bars"></i></a>
        </div>
        <div class="nav toggle">
          <a href="{{ URL::to('http://'.$_SERVER['HTTP_HOST']) }}" id=""><i class="fa fa-home"></i>Home</a>
        </div>

        <ul class="nav navbar-nav navbar-right">
          @if($navbar_menu->account)
            @foreach($navbar_menu->account as $rmenu)
              @if(count($rmenu->children)>0 && Auth::user())
                <?php
                $label = str_replace("{name}",Auth::user()->name,$rmenu->label);
                if($rmenu->label=="{email}"){
                  $label =  str_replace("{email}",Auth::user()->email,$rmenu->label);
                }

                ?>

                <li class="">
                  <a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <img src="@if(Auth::user()->image) {{ URL::to(Auth::user()->image) }} @else {{ URL::to('images/img.png') }} @endif" alt="">{{ $label }}
                    <span class=" fa fa-angle-down"></span>
                  </a>
                  <ul class="dropdown-menu dropdown-usermenu animated fadeInDown pull-right">
                    @foreach($rmenu->children as $child)
                      <?php
                      if($child->url=="{website}"){
                        $www_url = $www->home_url;
                   $ww_array = explode('/',$www_url);
                        unset($ww_array[count($ww_array)-1]);
                        $child->url=implode('/',$ww_array);
                      }
                              ?>
                      <li><a href="{{ URL::to($child->url) }}"><i class="fa {{ $child->icon }}"></i> {{ $child->label }}</a></li>
                      </li>
                    @endforeach
                  </ul>
                </li>
              @else
              @endif
            @endforeach
          @endif
          @include('includes.messages')
        </ul>
      </nav>
    </div>

  </div>
  <!-- /top navigation -->



  <div id="right_col" class="right_col" role="main">
    <br/>
    <br/>
    @if(@Auth::user()->role=='admin')
    <form class="form-horizontal">
      <div class="form-group">
        <div class="col-md-4">
          <input name="search" value="{{ Request::get('search') }}" placeholder="Search current records" type="text" class="form-control">
        </div>
      </div>
    </form>
    @endif
    @yield('content')
  </div>
  <!-- /page content -->

</div>

虽然这是我编译的输出:

<div class="main_container">

  <div class="col-md-3 left_col">
    <div class="left_col scroll-view">

      <div class="navbar nav_title" style="border: 0;">
        <a href="<?php echo e(URL::to($navbar_menu->url)); ?>" class="site_title"><i class="fa fa-paw"></i> <span><?php echo e($navbar_menu->label); ?></span></a>
      </div>
      <div class="clearfix"></div>

      <!-- menu prile quick info -->
      <div class="profile">
        <div class="profile_pic">
          <img height="" src="<?php if(@Auth::user()->image): ?> <?php echo e(URL::to(Auth::user()->image)); ?> <?php else: ?> <?php echo e(URL::to('images/img.png')); ?> <?php endif; ?>" alt="..." class="img-circle profile_img">
        </div>
        <div class="profile_info row">
          <span>Welcome,</span>
          <?php if(Auth::user()): ?>
            <h2><?php echo e(Auth::user()->name); ?></h2>
            <?php else: ?>
            <h2>Guest</h2>
          <?php endif; ?>

        </div>
      </div>
      <!-- /menu prile quick info -->

      <br />

      <!-- sidebar menu -->
      <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">

        <div class="menu_section">
          <h3>General</h3>
          <ul class="nav side-menu">
            <?php foreach($menus as $menu): ?>
              <?php if($menu->type=='single' && @$menu->allow_writer != 'no'): ?>
                <?php if($www->designer == 1): ?>
                  <?php
                  $real_label = strtolower($menu->menus->label);
                  $real_label = str_replace('orders','projects',$real_label);
                  $design_label = ucwords($real_label);
                  ?>
                  <li>
                    <a href="<?php echo e(URL::to($menu->menus->url)); ?>"><i class="fa <?php echo e($menu->menus->icon); ?>"></i> <?php echo e($design_label); ?>&nbsp;&nbsp;&nbsp;<span class="" id="<?php echo e(@$menu->slug); ?>"></span></a>
                  </li>
                <?php else: ?>
                  <li>
                    <a href="<?php echo e(URL::to($menu->menus->url)); ?>"><i class="fa <?php echo e($menu->menus->icon); ?>"></i> <?php echo e($menu->menus->label); ?>&nbsp;&nbsp;&nbsp;<span class="" id="<?php echo e(@$menu->slug); ?>"></span></a>
                  </li>
                  <?php endif; ?>
              <?php endif; ?>

              <?php if($menu->type=='many'): ?>
                  <li><a><i class="fa <?php echo e($menu->icon); ?>"></i> <?php echo e($menu->label); ?> <span class="fa fa-chevron-down"></span></a>
                    <ul class="nav child_menu" style="display: none">
                      <?php foreach($menu->menus as $drop): ?>
                        <?php if($drop->label): ?>
                        <li><a href="<?php echo e(URL::to($drop->url)); ?>"><?php echo e($drop->label); ?></a><li>
                        <?php endif; ?>
                      <?php endforeach; ?>
                    </ul>
                  </li>
              <?php endif; ?>
            <?php endforeach; ?>
          </ul>
        </div>

      </div>
      <!-- /sidebar menu -->

      <!-- /menu footer buttons -->
      <?php /*<div class="sidebar-footer hidden-small">*/ ?>
        <?php /*<a data-toggle="tooltip" data-placement="top" title="Settings">*/ ?>
          <?php /*<span class="glyphicon glyphicon-cog" aria-hidden="true"></span>*/ ?>
        <?php /*</a>*/ ?>
        <?php /*<a data-toggle="tooltip" data-placement="top" title="FullScreen">*/ ?>
          <?php /*<span class="glyphicon glyphicon-fullscreen" aria-hidden="true"></span>*/ ?>
        <?php /*</a>*/ ?>
        <?php /*<a data-toggle="tooltip" data-placement="top" title="Lock">*/ ?>
          <?php /*<span class="glyphicon glyphicon-eye-close" aria-hidden="true"></span>*/ ?>
        <?php /*</a>*/ ?>
         <?php /*<a href="<?php echo e(URL::to('logout')); ?>" data-placement="top" title="Logout">*/ ?>
          <?php /*<span class="glyphicon glyphicon-off" aria-hidden="true"></span>*/ ?>
        <?php /*</a>*/ ?>
      <?php /*</div>*/ ?>
      <!-- /menu footer buttons -->
    </div>
  </div>

  <!-- top navigation -->
  <div class="top_nav">

    <div class="nav_menu">
      <nav class="" role="navigation">
        <div class="nav toggle">
          <a id="menu_toggle"><i class="fa fa-bars"></i></a>
        </div>
        <div class="nav toggle">
          <a href="<?php echo e(URL::to('http://'.$_SERVER['HTTP_HOST'])); ?>" id=""><i class="fa fa-home"></i>Home</a>
        </div>

        <ul class="nav navbar-nav navbar-right">
          <?php if($navbar_menu->account): ?>
            <?php foreach($navbar_menu->account as $rmenu): ?>
              <?php if(count($rmenu->children)>0 && Auth::user()): ?>
                <?php
                $label = str_replace("{name}",Auth::user()->name,$rmenu->label);
                if($rmenu->label=="{email}"){
                  $label =  str_replace("{email}",Auth::user()->email,$rmenu->label);
                }

                ?>

                <li class="">
                  <a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <img src="<?php if(Auth::user()->image): ?> <?php echo e(URL::to(Auth::user()->image)); ?> <?php else: ?> <?php echo e(URL::to('images/img.png')); ?> <?php endif; ?>" alt=""><?php echo e($label); ?>

                    <span class=" fa fa-angle-down"></span>
                  </a>
                  <ul class="dropdown-menu dropdown-usermenu animated fadeInDown pull-right">
                    <?php foreach($rmenu->children as $child): ?>
                      <?php
                      if($child->url=="{website}"){
                        $www_url = $www->home_url;
                   $ww_array = explode('/',$www_url);
                        unset($ww_array[count($ww_array)-1]);
                        $child->url=implode('/',$ww_array);
                      }
                              ?>
                      <li><a href="<?php echo e(URL::to($child->url)); ?>"><i class="fa <?php echo e($child->icon); ?>"></i> <?php echo e($child->label); ?></a></li>
                      </li>
                    <?php endforeach; ?>
                  </ul>
                </li>
              <?php else: ?>
              <?php endif; ?>
            <?php endforeach; ?>
          <?php endif; ?>
          <?php echo $__env->make('includes.messages', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
        </ul>
      </nav>
    </div>

  </div>
  <!-- /top navigation -->



  <div id="right_col" class="right_col" role="main">
    <br/>
    <br/>
    <?php if(@Auth::user()->role=='admin'): ?>
    <form class="form-horizontal">
      <div class="form-group">
        <div class="col-md-4">
          <input name="search" value="<?php echo e(Request::get('search')); ?>" placeholder="Search current records" type="text" class="form-control">
        </div>
      </div>
    </form>
    <?php endif; ?>
    <?php echo $__env->yieldContent('content'); ?>
  </div>
  <!-- /page content -->

</div>

'

我已经尝试了 运行 Artisan php artisan route:cachephp artisan cache:clear 但没有任何效果。我不断收到同样的错误。请帮助:(

尝试在条件

中使用isset
if(isset($www->designer) && $www->designer == 1)