PHP code example of litvinjuan / laravel-cascade-soft-deletes
1. Go to this page and download the library: Download litvinjuan/laravel-cascade-soft-deletes library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
litvinjuan / laravel-cascade-soft-deletes example snippets
class Team extends Model
{
use CascadeSoftDeletes;
protected $cascadeSofDeleteRelations = ['projects'];
public function projects() {
return $this->hasMany(Project::class);
}
}
class Project extends Model
{
use CascadeSoftDeletes;
protected $cascadeSofDeleteRelations = ['tasks'];
public function team() {
return $this->belongsTo(Team::class);
}
public function task() {
return $this->hasMany(Task::class);
}
}
class Task extends Model
{
public function project() {
return $this->belongsTo(Project::class);
}
}
bash
php artisan vendor:publish --tag="laravel-cascade-soft-deletes-config"