簡體   English   中英

如何在Laravel 5.1中顯示引導成功消息

[英]how to display bootstrap success message in laravel 5.1

嗨,Friend的需要幫助如何在laravel 5.1中顯示成功消息,我已經應用了它,但是兩次顯示是什么原因。 這是我的layout.balde.php代碼

@if (session()->has('success'))
<div class="alert-success" id="popup_notification">
    <strong>{!! trans('main.message') !!}</strong>{{ session('success') }}
</div>

@endif這是我的控制器頁面代碼:

  return Redirect::route($this->cdroute, array($customer_id))->with('success',trans($this->updatemsg));

嘗試這個:

//in controller
    return Redirect::route($this->cdroute, array($customer_id))->with('success',trans($this->updatemsg));

//in blade template
    @if (session('success'))
        <div class="alert alert-success">
            {{ session('success') }}
        </div>
    @endif

嘗試這個:

控制器頁面代碼:

Session::flash('success',trans($this->updatemsg));
Redirect::route($this->cdroute, array($customer_id));

layout.balde.php代碼

@if ( Session::has('success') )
   <div class="alert-success" id="popup_notification">
     {{ Session::get('success') }}
  </div>      
@endif

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM