我想通过 yajra 数据表中的 url id 查询表,但我无法查询缺少的参数。
控制器
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']);