View
{!! Form::open(['url' => ['employee/del', $record['user_id_fk']], 'method' => 'delete']) !!} <a href="/employee/del/{!!$record['id']!!}" onclick='return confirm("Are you sure you want to delete ?")'></a> {!! Form::close() !!}
Route
Route::get('employee/del/{id}', 'EmployeeController@destroy');
Controller
public function destroy($id){ //delete query & functinality }
It may works for you
I usually make a route for that, it's maybe not obeying the restful principles, but it works and I haven't found better solutions yet.
Your route look something like
Route::resource('employee', 'EmployeeController');
Then add this route too
Route::get('employee/delete/{employee}', ['as' => 'employee.delete', 'uses' => 'EmployeeController@destroy']);
You can now define your link as
<a href="{{ route('employee.delete', $employee->id) }}">Delete</a>
derkatzer liked this reply
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community