Mahmoud Nassar Mahmoud Nassar - 1 year ago 100
HTML Question

Using Route Parameter return the view incomplete and without Css [Laravel 5]

When I user this Route :

Route::get('home', function()
return View::make('index');

with URL:


It get the view and works well .

But when use this Route:

Route::get('home/{id}', function($id)
return View::make('index')->with('id', $id);

with URL:


It the view but doesn't work well that view come without any CSS, JS, .. etc

I can't define the ERROR here ?!

Answer Source

Yeah, I know this is very late and this is very old question but I also get the same problem and I also stuck in the same situation. But after reading doing some research on the google and I got the answer of it. I posted this answer because it may be helpful to someone.

This problems is occurred because of the we are using the relative path in our blade template and the solution is so simple. We have to use only the asset function to overcome this problem.

So change your code like this...

<link href="{{ asset('css/bootstrap.min.css') }}" rel='stylesheet' type='text/css' />
<script src="{{ asset('js/jquery.min.js') }}"> </script>

I hope it may be helpful to someone...

Happy Coding :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download