laravel 5.4 yajra 数据table 无法通过 url id 查询 table 说缺少必需的参数
laravel 5.4 yajra datatable cant query table by url id says Missing required parameters
我想通过 yajra 数据中的 url id 查询 table table 但我无法查询缺少的参数。
控制器
public function getpostshow($id,request $request)
{
$medrep = Medrep::find($id);
$req = $request->segment(2);
$users = DB::table('itinerarys')
->select('doctors.*','medreps.*','itinerarys.*')
->join('doctors', 'itinerarys.doctor', '=', 'doctors.doctor_id')
->join('medreps', 'itinerarys.medrep', '=', 'medreps.medrep_id')
->where('itinerarys.medrep', '=', $req);
return Datatables::of($users)
->editColumn('EmployeeLastName', '{!! str_limit($EmployeeLastName, 60) !!}')
->editColumn('CustomerCode', '{!! str_limit($CustomerCode, 60) !!}')
->editColumn('CustomerLastName', '{!! str_limit($CustomerLastName, 60) !!}')
->make(true);
}
路线
Route::get('medrep/{id}/getpostshow',
['as'=>'medrep.getpostshow','uses'=>'MedrepController@getpostshow']);
你应该像这样在 Request 之后使用 $id 参数:
public function getpostshow(Request $request,$id)
并且请求参数是Request $request
而不是request $request
调用路由时必须传值
{{ route('medrep.getposts', ['id' => 1]) }}
我想通过 yajra 数据中的 url id 查询 table table 但我无法查询缺少的参数。
控制器
public function getpostshow($id,request $request)
{
$medrep = Medrep::find($id);
$req = $request->segment(2);
$users = DB::table('itinerarys')
->select('doctors.*','medreps.*','itinerarys.*')
->join('doctors', 'itinerarys.doctor', '=', 'doctors.doctor_id')
->join('medreps', 'itinerarys.medrep', '=', 'medreps.medrep_id')
->where('itinerarys.medrep', '=', $req);
return Datatables::of($users)
->editColumn('EmployeeLastName', '{!! str_limit($EmployeeLastName, 60) !!}')
->editColumn('CustomerCode', '{!! str_limit($CustomerCode, 60) !!}')
->editColumn('CustomerLastName', '{!! str_limit($CustomerLastName, 60) !!}')
->make(true);
}
路线
Route::get('medrep/{id}/getpostshow',
['as'=>'medrep.getpostshow','uses'=>'MedrepController@getpostshow']);
你应该像这样在 Request 之后使用 $id 参数:
public function getpostshow(Request $request,$id)
并且请求参数是Request $request
而不是request $request
调用路由时必须传值
{{ route('medrep.getposts', ['id' => 1]) }}