1

I setup the following Routes for now (Moving a barebone php project to laravel):

Route::get('/', function () {
    return view('index');
});

Route::get('cat/a', function (){
    return view('cat.cat_a');
});

Both Files include 4 other Files located in /resources/views/includes. I load those files using:

@include('includes.header')
@include('includes.sidebar_a')

[...] Content [...]

@include('includes.sidebar_b')
@include('includes.footer')

All includes are correctly included in both, domain.com/ aswell as domain.com/cat/a but whitin the view domain.com/cat/a all included css & js files (included in footer.blade.php & header.blade.php) return 404.

Here is my file structure:

enter image description here

1 Answer 1

1

You should use asset helper to generate links to JS&CSS:

{{ asset('js/main.js') }}

In this case you'll get HTML with correct paths.

Sign up to request clarification or add additional context in comments.

1 Comment

Works nice, thank you. However just without the smemicolon

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.