I am fetching data in yajra DT and add the column for edit and delete but don't understand how to set route and get the id from url to edit that specific employee.
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);
}
this code showing that this url is not defined. i am confuse that how to define it
Looking at the code you posted you can try something like that in your routes/web.php
file:
Route::get('/employees/{user}/edit', 'employee@employeeedit');