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