| @@ -2,7 +2,8 @@ | |||
| namespace App\Http\Controllers; | |||
| use App\Model\Coverage; | |||
| use App\Model\Form; | |||
| use App\Model\WorkOrder; | |||
| use Illuminate\Foundation\Bus\DispatchesJobs; | |||
| use Illuminate\Routing\Controller as BaseController; | |||
| use Illuminate\Foundation\Validation\ValidatesRequests; | |||
| @@ -12,37 +13,21 @@ class Controller extends BaseController | |||
| { | |||
| use AuthorizesRequests, DispatchesJobs, ValidatesRequests; | |||
| public function taggingCategory(){ | |||
| public function taggingCategory() | |||
| { | |||
| $response = json_decode(file_get_contents(public_path() . '/test.json')); | |||
| if ($response->success == true) { | |||
| foreach ($response->data as $key => $r) { | |||
| $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{ | |||
| } | |||
| $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(); | |||
| } | |||
| return 'data inserted ' ; | |||
| return 'data inserted '; | |||
| } | |||
| } | |||
| } | |||