2017-05-27 79 views
0

我最近已經將我的項目從Laravel 5.1升級到了5.4。除了不顯示的閃光消息外,一切正常。我有進行以下檢查,以確保我沒有做錯事:laravel /閃存沒有顯示laravel 5.4

  1. RouteServiceProvider.php

的網絡中間件組由mapWebRoutes功能自動添加到我的路線

+--------+----------+-----+--------+------------------------------------------+--------------+ 
| Domain | Method | URI | Name | Action         | Middleware | 
+--------+----------+-----+---------------------------------------------------+--------------+ 
|  | GET|HEAD |/ |  | App\Http\Controllers\[email protected]| web,auth  | 
  1. Kernel.php

下面是中間件基團在Kernel.php)的含量

'web' => [ 
       \App\Http\Middleware\EncryptCookies::class, 
       \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 
       \Illuminate\Session\Middleware\StartSession::class, 
       // \Illuminate\Session\Middleware\AuthenticateSession::class, 
       \Illuminate\View\Middleware\ShareErrorsFromSession::class, 
       \App\Http\Middleware\VerifyCsrfToken::class, 
       \Illuminate\Routing\Middleware\SubstituteBindings::class, 
      ], 
  • 閃光燈(之前放置重定向

    閃光燈() - >成功('鮑勃石新增成功'); $ target_location ='cia_agent /'。 $ agent_id。'/ profile'; return redirect($ target_location);

  • 只有一個302 reponse在Chrome開發者工具中的Network中返回。

    上面的代碼在Laravel 5.1中工作,我在這裏失蹤了什麼?

    +0

    您使用的是哪個版本的軟件包?你有沒有嘗試更新閃存包到最新版本? – Sandeesh

    +0

    我正在使用laracasts/flash 3.0 –

    +0

    對部分用於顯示消息的視圖進行了更改。如果您已發佈並使用它,則需要手動更改它。 https://github.com/laracasts/flash/blob/master/src/views/message.blade.php這是從發佈更改日誌https://github.com/laracasts/flash/releases/tag/3.0.0 – Sandeesh

    回答

    1

    挖掘之後,我找到了解決方案。在/resources/views/vendor/flash/message.blade.php,我有以下代碼將其工作Laravel 5.1

    @if (Session::has('flash_notification.message')) 
        @if (Session::has('flash_notification.overlay')) 
         @include('flash::modal', ['modalClass' => 'flash-modal', 'title' => Session::get('flash_notification.title'), 'body' => Session::get('flash_notification.message')]) 
        @else 
         <div class="alert alert-{{ Session::get('flash_notification.level') }}"> 
          <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button> 
    
          {{ Session::get('flash_notification.message') }} 
         </div> 
        @endif 
    @endif 
    

    但是,由於有已與Laracasts /閃光視圖的變化部分用於顯示消息,我把新的代碼放在文件中:

    @foreach ((array) session('flash_notification') as $message) 
        @if ($message['overlay']) 
         @include('flash::modal', [ 
          'modalClass' => 'flash-modal', 
          'title'  => $message['title'], 
          'body'  => $message['message'] 
         ]) 
        @else 
         <div class="alert 
            alert-{{ $message['level'] }} 
            {{ $message['important'] ? 'alert-important' : '' }}" 
          role="alert" 
           > 
          @if ($message['important']) 
           <button type="button" 
             class="close" 
             data-dismiss="alert" 
             aria-hidden="true" 
             >&times;</button> 
          @endif 
    
          {!! $message['message'] !!} 
         </div> 
        @endif 
    @endforeach 
    
    {{ session()->forget('flash_notification') }} 
    

    它現在工作很完美。