<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>PHPOnlineSupport - Recent questions tagged dynamic</title>
<link>http://phponlinesupport.com/tag/dynamic</link>
<description>Powered by Portrave Solutions Pvt. Ltd.</description>
<item>
<title>load js files dynamically on the fly</title>
<link>http://phponlinesupport.com/166/load-js-files-dynamically-on-the-fly</link>
<description>


&lt;p&gt;How can I tell Laravel-5 which Javascript files I want to include in a template.&lt;/p&gt;

&lt;p&gt;For example, I have my Controller with something like this:&lt;/p&gt;

&lt;pre&gt;return view('butchery', ['locations' =&amp;gt; $locations, 'classTypes' =&amp;gt; $classTypes]);&lt;/pre&gt;

&lt;p&gt;I have my &lt;em&gt;butchery.blade.php&lt;/em&gt; template with my html:&lt;/p&gt;

&lt;pre&gt;@extends('app')
@section('content')
&amp;lt;!-- html here --&amp;gt;
@endsection&lt;/pre&gt;

&lt;p&gt;...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?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;app.blade.php&lt;/em&gt;:&lt;/p&gt;

&lt;pre&gt;&amp;lt;!DOCTYPE HTML&amp;gt;
&amp;lt;!--[if IE 8]&amp;gt;&amp;lt;html class=&quot;ie8&quot;&amp;gt; &amp;lt;![endif]--&amp;gt;
&amp;lt;!--[if gt IE 8]&amp;gt;&amp;lt;!--&amp;gt;&amp;lt;html&amp;gt;&amp;lt;!--&amp;lt;![endif]--&amp;gt;

&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;@yield('content')&amp;lt;/body&amp;gt;
&amp;lt;script src=&quot;/js/mobile-menu.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;!-- apply voucher code --&amp;gt; 
&amp;lt;script src=&quot;/js/voucher-apply.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;
</description>
<category>Laravel</category>
<guid isPermaLink="true">http://phponlinesupport.com/166/load-js-files-dynamically-on-the-fly</guid>
<pubDate>Mon, 17 Oct 2016 03:22:30 +0000</pubDate>
</item>
</channel>
</rss>