Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Controller.php 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Model\Form;
  4. use App\Model\Subscriber;
  5. use App\Model\WorkOrder;
  6. use Illuminate\Foundation\Bus\DispatchesJobs;
  7. use Illuminate\Routing\Controller as BaseController;
  8. use Illuminate\Foundation\Validation\ValidatesRequests;
  9. use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
  10. class Controller extends BaseController
  11. {
  12. use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
  13. public function updateCity()
  14. {
  15. $subscribers = Subscriber::all();
  16. foreach ($subscribers as $key => $a) {
  17. $a->unit_no = strtoupper($a->unit_no);
  18. $a->building_name = strtoupper($a->building_name);
  19. $a->street = strtoupper($a->street);
  20. $a->city = strtoupper($a->city);
  21. $a->state = strtoupper($a->state);
  22. $a->save();
  23. }
  24. return "Done standardize city in DB";
  25. }
  26. public function taggingCategory()
  27. {
  28. $response = json_decode(file_get_contents(public_path() . '/test.json'));
  29. if ($response->success == true) {
  30. foreach ($response->data as $key => $r) {
  31. $work_order = WorkOrder::where('wo', $r->wo)->first();
  32. if (!empty($work_order)) {
  33. $form_submitted = Form::where('_id', $work_order->_id)->first();
  34. $form_submitted->customer_category = $r->category;
  35. $form_submitted->save();
  36. }
  37. }
  38. return 'data inserted ';
  39. }
  40. }
  41. }