Enabling Soft-Delete

This is only to assist with the enabling soft-deletion for your models within the Laravel Admin Panel. Please refer to the Laravel documentation for specifics.

Table Configurations in Laravel Admin Panel

If you selected the "Add Soft Deletes" button when creating a table using the Database Manager, and then adding the CRUD functionality to this table, you added the model name, you only need to edit the model file to fully include Soft-Delete to this table.

Editing the Table's Model

A default model will look like this:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class ModelName extends Model
{
    
}

Just turn it into:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class ModelName extends Model
{
    use SoftDeletes;
    protected $dates = ['deleted_at'];
}

And now, every time you delete an entry from this table, it will not actually be deleted, only the column "deleted_at" will be written with the current timestamp.