diff --git a/app/Models/AssignMaterial.php b/app/Models/AssignMaterial.php index 5cb8bc5..0c282a6 100644 --- a/app/Models/AssignMaterial.php +++ b/app/Models/AssignMaterial.php @@ -5,6 +5,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; use App\Models\RequestMaterial; use App\Models\Activity; +use App\Models\ReportActivityMaterial; class AssignMaterial extends Model { @@ -35,6 +36,7 @@ class AssignMaterial extends Model }); static::deleted(function($data) { + $reportActivities = ReportActivityMaterial::where('assign_material_id', $data->id)->delete(); $activity = Activity::where('id', $data->activity_id)->first(); $activity->rencana_biaya -= floatval($data->budget) * floatval($data->qty_planning); $activity->save();