Browse Source

delete report when delete overhead

pull/3/head
Wahyu Ramadhan 1 year ago
parent
commit
65833f1455
  1. 2
      app/Models/AssignMaterial.php

2
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();

Loading…
Cancel
Save