This is only to assist with enabling soft-deletion for your models within Voyager. Please refer to the Laravel documentation for specifics.
Table Configurations in Voyager
When creating a table using the Database Manager you've selected the 'Add Soft Deletes' button and then when adding the BREAD functionality to that table you've added a Model Name, you only have to edit your Model file to fully enable Soft-Delete on that table.
Editing the Table's Model
A default model will look like this:
1
<?php
2
​
3
namespaceApp;
4
​
5
useIlluminate\Database\Eloquent\Model;
6
​
7
​
8
classYourModelNameextendsModel
9
{
10
​
11
}
Copied!
Just turn it into:
1
<?php
2
​
3
namespaceApp;
4
​
5
useIlluminate\Database\Eloquent\Model;
6
useIlluminate\Database\Eloquent\SoftDeletes;
7
​
8
​
9
classDocumentoextendsModel
10
{
11
useSoftDeletes;
12
protected$dates=['deleted_at'];
13
}
Copied!
And from now on, every time you delete a record from that table, it won't actually be deleted, only the deleted_at column will be written with the current timestamp.