Answers for "softDelete laravel8"

PHP
0

softDelete laravel8

//i will softDelete for contact 
<------------1 In Contact Modal---------->
namespace App\Models;

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

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
Posted by: Guest on May-07-2022

Browse Popular Code Answers by Language