|
|
@@ -2,8 +2,7 @@ |
|
|
|
|
|
|
|
namespace App\Http\Controllers; |
|
|
|
|
|
|
|
use App\Model\Form; |
|
|
|
use App\Model\WorkOrder; |
|
|
|
use App\Model\Coverage; |
|
|
|
use Illuminate\Foundation\Bus\DispatchesJobs; |
|
|
|
use Illuminate\Routing\Controller as BaseController; |
|
|
|
use Illuminate\Foundation\Validation\ValidatesRequests; |
|
|
@@ -19,11 +18,27 @@ class Controller extends BaseController |
|
|
|
if ($response->success == true) { |
|
|
|
|
|
|
|
foreach ($response->data as $key => $r) { |
|
|
|
$work_order = WorkOrder::where('wo',$r->wo)->first(); |
|
|
|
$form_submitted = Form::where('_id',$work_order->_id)->first(); |
|
|
|
|
|
|
|
$form_submitted->customer_category = $r->category; |
|
|
|
$form_submitted->save(); |
|
|
|
|
|
|
|
$coverage = Coverage::where(strtoupper('building_name'),strtoupper($r->building_name))->where(strtoupper('street'),strtoupper($r->street))->where('Type',$r->Type)->get(); |
|
|
|
|
|
|
|
if(count($coverage)==0){ |
|
|
|
$coveragedetails = [ |
|
|
|
'Type' => $r->Type, |
|
|
|
'building_name' => strtoupper($r->building_name), |
|
|
|
'project_type' => $r->project_type, |
|
|
|
'street' => strtoupper($r->street), |
|
|
|
'city' => strtoupper($r->city), |
|
|
|
'state' => strtoupper($r->state), |
|
|
|
'postcode' => $r->postcode, |
|
|
|
'installation_fee' => $r->installation_fee, |
|
|
|
'status_building' => $r->status_building, |
|
|
|
'jmb_email' => "", |
|
|
|
]; |
|
|
|
|
|
|
|
$coverageUpdate = Coverage::create($coveragedetails); |
|
|
|
}else{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|