我正在yajra DT中获取数据,并添加了用于编辑和删除的列,但不了解如何设置路由并从url获取ID以编辑该特定员工。
public function fullEmp(){
$data=employees::select('*')->orderBy('employee_id','DESC');
return Datatables::of($data)->addColumn('action', function ($data) {
return '<a href="'.action('employee@employeeedit', ['user' => $data->id]).'" class="btn btn-primary btn-sm mb-1">
<i class="fa fa-pencil" aria-hidden="true"></i>
</a>';
})->make(true);
}
此代码表明未定义此网址。我对如何定义它感到困惑
查看您发布的代码,您可以在routes/web.php
文件中尝试类似的操作:
Route::get('/employees/{user}/edit', 'employee@employeeedit');
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句