This is my route file...
Route::group(['middleware' => ['auth']], function(){
Route::get('/profile/{username}', 'ProfileControllers@getProfile');
});
The "ProfileControllers" is this...
namespace App\Http\Controllers;
use DB;
use App\User;
use Illuminate\Http\Request;
class ProfileControllers extends Controller
{
public function getProfile($username)
{
$user = DB::table('users')->where('username','=', $username)->get();
return view('web.profile');
}
}
And this is the view file...
@extends('layout')
@section('content')
This is your profile
@stop
And The head of the Layout file is this...
link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"
link rel="stylesheet" type="text/css" href="css/app.css"
When I go to the url "localhost:8000/profile/username" and a ugly html without any css webpage is showing.... when I remove "/{username}" from route file, and make it "/profile/username" and go to the "localhost:8000/profile/username" (and also remove the $username part form controller) , then css and bootstrap loads perfectly....
I fixed this issue by simply putting '/' in front of the link
link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css"
link rel="stylesheet" type="text/css" href="/css/app.css"
You can add this line at the top of the blade file.
{{ HTML::style('css/app.css') }}
OR
link rel="stylesheet" href="{{ url('css/bootstrap.min.css') }}"
Hope it works!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With