| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
-
- namespace App\Http\Controllers;
-
- use App\Model\Form;
- use App\Model\Subscriber;
- use App\Model\WorkOrder;
- use Illuminate\Foundation\Bus\DispatchesJobs;
- use Illuminate\Routing\Controller as BaseController;
- use Illuminate\Foundation\Validation\ValidatesRequests;
- use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
-
- class Controller extends BaseController
- {
- use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
-
- public function updateCity()
- {
- $subscribers = Subscriber::all();
-
- foreach ($subscribers as $key => $a) {
- $a->unit_no = strtoupper($a->unit_no);
- $a->building_name = strtoupper($a->building_name);
- $a->street = strtoupper($a->street);
- $a->city = strtoupper($a->city);
- $a->state = strtoupper($a->state);
- $a->save();
- }
-
- return "Done standardize city in DB";
- }
-
- public function taggingCategory()
- {
- $response = json_decode(file_get_contents(public_path() . '/test.json'));
-
- if ($response->success == true) {
-
- foreach ($response->data as $key => $r) {
- $work_order = WorkOrder::where('wo', $r->wo)->first();
-
- if (!empty($work_order)) {
- $form_submitted = Form::where('_id', $work_order->_id)->first();
-
- $form_submitted->customer_category = $r->category;
- $form_submitted->save();
- }
- }
-
- return 'data inserted ';
- }
- }
- }
|