load js files dynamically on the fly

+1 vote
asked Oct 17, 2016 in Laravel by Siva

How can I tell Laravel-5 which Javascript files I want to include in a template.

For example, I have my Controller with something like this:

return view('butchery', ['locations' => $locations, 'classTypes' => $classTypes]);

I have my butchery.blade.php template with my html:

<!-- html here -->

...and I have my app.blade.php container template with all my javascript files at the bottom. If I didn't want to include one of the javascript files in my view, how would I do that?


<!--[if IE 8]><html class="ie8"> <![endif]-->
<!--[if gt IE 8]><!--><html><!--<![endif]-->

<script src="/js/mobile-menu.js"></script>
<!-- apply voucher code --> 
<script src="/js/voucher-apply.js"></script>

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

Related questions

0 votes
1 answer 13 views
asked Jun 13, 2016 in Magento by Jelena
0 votes
0 answers 61 views
asked Feb 13 in Laravel by Simply
+1 vote
1 answer 215 views
asked Dec 7, 2016 in Laravel by Pinto
0 votes
0 answers 116 views
asked Dec 6, 2016 in Laravel by Jinu
0 votes
1 answer 293 views
+1 vote
1 answer 530 views