You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
587 B
29 lines
587 B
1 year ago
|
<?php
|
||
|
|
||
|
namespace App\Models;
|
||
|
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
||
|
class HierarchyFtth extends Model
|
||
|
{
|
||
|
protected $table = "m_hierarchy_ftth";
|
||
|
|
||
|
const CREATED_AT = 'created_at';
|
||
|
const UPDATED_AT = 'updated_at';
|
||
|
|
||
|
protected $fillable = [
|
||
|
'name', 'parent_id', 'project_id', 'created_at', 'updated_at', 'progress', 'bobot_planning'
|
||
|
];
|
||
|
|
||
|
public static function boot() {
|
||
|
parent::boot();
|
||
|
|
||
|
static::deleted(function($data) {
|
||
|
$ftths = HierarchyFtth::where('parent_id', $data->id)->get();
|
||
|
foreach ($ftths as $ftth) {
|
||
|
$ftth->delete();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|