İlk temizlik tamamlandı bir önceki projeden
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
$id = $request['key'];
|
||||
|
||||
// Get the paint matrix record before deletion
|
||||
$paintMatrix = db('paint_matrices')->where('id', $id)->first();
|
||||
|
||||
if ($paintMatrix) {
|
||||
// Delete from paint_follow_ups
|
||||
db('paint_follow_ups')
|
||||
->where([
|
||||
'line' => $paintMatrix->line,
|
||||
'area' => $paintMatrix->area,
|
||||
])
|
||||
->whereNull('primer_coating_start_date') // Only delete if primer coating start date is null
|
||||
->delete();
|
||||
|
||||
// Delete from construction_paint_logs
|
||||
db('construction_paint_logs')
|
||||
->where([
|
||||
'line' => $paintMatrix->line,
|
||||
'unit' => $paintMatrix->area,
|
||||
])
|
||||
->whereNull('painting_date_1') // Only delete if primer coating start date is null
|
||||
->delete();
|
||||
|
||||
dump("Deleted related records for paint matrix ID: $id");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user