Thursday, February 15, 2018

Error accessing resources while using routes Laravel 5.2 - development

Error accessing resources while using routes Laravel 5.2

At home page, i can access the resources like bootstrap, javascript and image then from home refer to news page then from newspage, it refers to newsDetail page. But in this newsDetails page, it access the wrong address of resources.
Example :
in Homepage, it correctly access
http://localhost:8000/css/bootstrap.min.css
http://localhost:8000/img/Logo.png

but in newsDetails page, it access http://localhost:8000/news/css/bootstrap.min.css
http://localhost:8000/news/img/Logo.png

It has the following ‘news’ on the address.
This is my routes

Route::get('/','HomeController@showHome');
Route::get('news','NewsController@showNews');
Route::get('news/{id}','NewsController@showNewsDetails');

Controller

public function showNewsDetails($id)
    {
        $content = News::find($id);
        return view('newsDetails',compact('content'));
    }

Can anyone help ?



from Laravel Questions and Answers https://laravelquestions.com/php/error-accessing-resources-while-using-routes-laravel-5-2/
via Lzo Media

No comments:

Post a Comment