Laravel 5 url :: asset () not showing in view

In my app.blade.php (master template) I have a section called @yield('scripts')

, located at the bottom of the page, like this:

    <html>
    <header>...</header>
    <body>

       ....
       <script src="{{ URL::asset('js/bootstrap.min.js')}}"></script>
       <script src="{{ URL::asset('js/site.js')}}"></script>
       @yield('scripts')
   </body>
   </html>

      

I have a view called index.blade.php that links to the previous section to add some scripts that are only used in this view like this:

  @section('scripts')

   <script src="{{ URL::asset('js/moment.js') }}"></script>
   <script src="{{ URL::asset('js/pikaday.js') }}"></script>

  @endsection

      

However, I noticed that the path for the first script that is declared js/moment.js

does not display correctly when viewing the source. For some strange reason, its display looks like this:

<script src="{{ URL::asset('js/moment.js')); ?>">
<script src="http://localhost:8000/js/pikaday.js"> 

      

I know the script is in the right place, and when I add a new script to the declaration above it, it seems like it looks great, but the first script always displays incorrectly. When I state the following:

  @section('scripts')

    <script src="{{ URL::asset('js/moment.js') }}"></script>
   <script src="{{ URL::asset('js/moment.js') }}"></script>
   <script src="{{ URL::asset('js/pikaday.js') }}"></script>

  @endsection

      

I am getting the following output:

 <script src="{{ URL::asset('js/moment.js')); ?>">
 <script src="http://localhost:8000/js/moment.js">
 <script src="http://localhost:8000/js/pikaday.js">

      

Does anyone know what's going on here?

+3


source to share





All Articles