Support the ongoing development of Laravel.io →
Database Views Forms
Last updated 2 years ago.
0

Then, no ones reply ...

0

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

0

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>
Last updated 8 years ago.

derkatzer liked this reply

1

Sign in to participate in this thread!

Eventy

Your banner here too?

csmatyi csmatyi Joined 12 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.