Laravel Soft Delete

Laravel Soft Delete

Soft Delete
Data Base 

In database add column ‘deleted_at’ in the table
deleted_at Field, default NULL value

Model

In model file add ‘use SoftDeletes’ statement
use Illuminate\Database\Eloquent\SoftDeletes;

class User extends Model {
use SoftDeletes;
}

 

Controller

In your controller file add destroy function.
public function destroy($id)
{
User::find($id)->delete();
}

Please follow and like us:
0

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.