In the js is capable of performing blade grammar? Or in the js PHP logic can handle it?
The answer is, of course, the
Let's look at demand: After submitting the form, complete warehousing operation,
return redirect (route ( 'admin.user.index')) -> with ( 'Success', 'added successfully');
Jump, and carry some information, and the message printed on the page, this matter needs.
At first, I was so print information
@if(!empty(session('success'))) <div id="tips" class="Huialert Huialert-error text-c" ><i class="Hui-iconfont"></i> <li>{{session('success')}}</li> </div> @endif
But always feeling not enough senior, so I had an idea, you want to display this message for some time, go away
Thus, the idea of the process related to js logic arises, the following code was born
$(document).ready(function(){ @if(!empty(session('success'))) { layer.msg('{{session('success')}}!',{icon:1,time:2000}); } @endif });
There is no doubt that it can be run, and reached for my needs