I'm using laravel 5.2. In a current view, how can I know if this view is called before? Any suggestions?
Update:
Here's the scenario, I have a script in a view, and I want to run it once: the first time the view got called.
I'm using laravel 5.2. In a current view, how can I know if this view is called before? Any suggestions?
Update:
Here's the scenario, I have a script in a view, and I want to run it once: the first time the view got called.
Ok, I managed to solved this by myself. This javascript code will run once the first time the view got called:
@if (! $__env->yieldContent('some_section_script'))
@section ('some_section_script')
<script type="text/javascript">
console.log('Hello world');
</script>
@stop
@yield('some_section_script')
@endif