Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

santiago.correa.e's avatar

Layouts of my laravel is not working

I have 3 layouts master, footer and nav_bar, they are working when I use them in my index.blade.php (extends master and include footer and nav-bar) but I create a new file and I literally copied the layouts from index and pasted the in the new one (named show.blade.php) but it is not working because it doesn't bring me any of my css.

all of this is inside a folder that I create in views named admin, here is the code of both index and show:

@extends('admin.layouts.master')

@section('content')

        @include ('admin.layouts.top_bar')

        @include ('admin.layouts.nav_bar')


        @include('admin.layouts.footer')


@endsection

I try just putting everything together in the show.blade.php but still not working, it is like if the links of the master blade are only working for index.

0 likes
8 replies
santiago.correa.e's avatar

@bastman69 I already did it and it didn't work, what I think is really strange is that everything is working just fine on index but exactly the same code doesn't work, but it is only the style part, the content is being shown

bastman69's avatar
Level 15

i guess you have placed you css files in the public/css directory.

replace your links like this

<link href=" {{ URL::asset('css/bootstrap.min.css') }}" rel="stylesheet">

give it a try

1 like
thoasty's avatar

Maybe you dont link your stylesheet(s) to absolute paths.

santiago.correa.e's avatar

@bastman69 that worked for me, but Do I have to do this:

{{ URL::asset('css/bootstrap.min.css') }}   

everytime I want to point to the public directory?

I also have in my public all the images that I need for my blade for example I had to change this:

<a href="index.html"><img src="assets/img/sioma-logo.png" alt="Sioma Staff" />

to this:

<a href="index.html"><img src="{{ URL::asset('assets/img/sioma-logo.png') }}" alt="Sioma Staff" /></a>

All I want to know is if I have to do this every time and why it is working on index without it?

bastman69's avatar

I have not figured out why this is happening but i was on a similar situation and that solution worked for me.

1 like
thoasty's avatar

No, you just have to use absolutes paths to your resources. Instead of

<a href="index.html"><img src="assets/img/sioma-logo.png" alt="Sioma Staff" />

you would just have to write:

<a href="index.html"><img src="/assets/img/sioma-logo.png" alt="Sioma Staff" />

(See the starting "/")

The quoted URL::asset helper function does that for you, but the use is not neccessary.

Down the line, if you have a page with the url "/mypage/" and you link your resources relatively like you did, the browser tries to find the resources inside the folderpath "mypage": "mypage/assets/img/sioma-logo.png" that does not exist.

Please or to participate in this conversation.