Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

softDelete laravel8

//i will softDelete for contact 
<------------1 In Contact Modal---------->
namespace AppModels;

use IlluminateDatabaseEloquentFactoriesHasFactory;
use IlluminateDatabaseEloquentModel;
use IlluminateDatabaseEloquentSoftDeletes;

class Contact extends Model
{
    use HasFactory;
    use SoftDeletes;

}

<---------2 create file for add delete_at column in contact table------------>
php artisan make:migration add_deleted_at_to_contacts_table
database > migration >567890874_add_deleted_at_to_contacts_table.php

<----------3 declare 


Source by medium.com #
 
PREVIOUS NEXT
Tagged: #softDelete
ADD COMMENT
Topic
Name
5+7 =