Browse Source

add condition if wo not empty

ifah
Siti Hajar Ibrahim 5 years ago
parent
commit
cbf27fbeba
1 changed files with 3 additions and 0 deletions
  1. 3
    0
      app/Http/Controllers/Controller.php

+ 3
- 0
app/Http/Controllers/Controller.php View File



foreach ($response->data as $key => $r) { foreach ($response->data as $key => $r) {
$work_order = WorkOrder::where('wo', $r->wo)->first(); $work_order = WorkOrder::where('wo', $r->wo)->first();

if(!empty($work_order)){
$form_submitted = Form::where('_id', $work_order->_id)->first(); $form_submitted = Form::where('_id', $work_order->_id)->first();


$form_submitted->customer_category = $r->category; $form_submitted->customer_category = $r->category;
$form_submitted->save(); $form_submitted->save();
}
} }


return 'data inserted '; return 'data inserted ';

Loading…
Cancel
Save