Reputation: 51
I have problem with laravel 5 route. I have use
Route::get('Client-View/{id}', [
'as' => 'Client-View', 'uses' => 'ClientListController@editClient'
]);
or too
Route::get('Client-View/{id}', 'ClientListController@editClient');
the route work fine but some Js and image not found(404) when is use 'Client-View/{id}'
. If I use only '{id}'
that works .In case of 'Client-View/{id}'
HTTP request is http://meghavisa.dev/Client-View/assets/js/slidebars/slidebars.min.js
but it should look like this http://meghavisa.dev/assets/js/slidebars/slidebars.min.js
.
Controller--
<?php namespace App\Http\Controllers;
use App\User;
use Illuminate\Support\Facades\Input;
use Maatwebsite\Excel\Facades\Excel;
use Validator;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
class ClientListController extends Controller {
public function editClient($id){
$user = User::find($id);
return view('admin.client-view', ['clientView'=>$user]);
}
}
Please help Thank You !
Upvotes: 2
Views: 871
Reputation: 6740
I assume you are doing something like
<script src="js/script.js"></script>
You should use the asset() helper function like
<script src="{{ asset('js/script.js') }}"></script>
Use this function also for you image sources.
You could also try out http://laravelcollective.com/docs/5.0/html . Then you can include your scripts and styles like: ( And aditionally you also have the Form Facade back )
{!! Html::script('js/script.js') !!}
{!! Html::style('css/style.css') !!}
Upvotes: 1