style not loading via route controller

I have setup blog and its' database with form submitting.It works all fine.The blog grid view also works fine with query.When accessing a specific ad individually it partially loads the page, yet the values are loaded.


//store function
return redirect()->route('', $post->id);

//show function
 public function show($id)
        $post = Post::find($id);
        return view('user.productpage')->withPost($post);


Route::get('create-ad', '[email protected]');
Route::post('create-ad', '[email protected]')->name('store'); 
Route::get('ads/{id}', '[email protected]')->name('');

Route::get('ads','[email protected]')->name('show_ads');



<h1>{{ $post->year}}</h1>



What causes this. the css is working properly though. have run dump auto-load and artisan cache:clear .

Cameron replied 5 months ago

is that bladefile code above the user.productpage blade code?

can you try

return view('user.productpage', 
compact( 'post')
Cameron replied 5 months ago

also, if you are using webpack, it uses scss and compiles to public / css /app.css if that is the case in your app make sure your blade file is loading the css <link href="{{ asset('css/app.css') }}" rel="stylesheet"> or better <link rel="stylesheet" href="{{ mix('/css/app.css') }}">

alicetaylor replied 4 months ago

Thanks for sharing the information. It is very useful for my future. keep sharing

run 3

happy space replied 2 weeks ago

Hope this might work it out smoothly. As it is so hard to manage and control the controller, happy wheels free

Tithira Jayasekera replied 2 weeks ago Solution

This was a silly mistake i had done when referencing stylesheets,script files.I had referenced without specifying the resource directory.

<link href="css/styles.css" rel="stylesheet">


<link href="/css/styles.css" rel="stylesheet">

what this does is the browser tries to access the resources in


but the resources are saved in the public folder so we should specify that css folder is a directory in the public folder so it would access

most of the time this scenario works fine in the localhost but when you try emailing or upload to the server you get this tricky error.

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us