You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Model\DealerClaim;
  4. use App\Model\Form;
  5. use App\Model\Product;
  6. use App\Model\Subscriber;
  7. use App\Model\WorkOrder;
  8. use Carbon\Carbon;
  9. use Illuminate\Foundation\Bus\DispatchesJobs;
  10. use Illuminate\Routing\Controller as BaseController;
  11. use Illuminate\Foundation\Validation\ValidatesRequests;
  12. use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
  13. class Controller extends BaseController
  14. {
  15. use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
  16. public function updateCity()
  17. {
  18. $subscribers = Subscriber::all();
  19. foreach ($subscribers as $key => $a) {
  20. $a->unit_no = strtoupper($a->unit_no);
  21. $a->building_name = strtoupper($a->building_name);
  22. $a->street = strtoupper($a->street);
  23. $a->city = strtoupper($a->city);
  24. $a->state = strtoupper($a->state);
  25. $a->save();
  26. }
  27. return "Done standardize city in DB";
  28. }
  29. public function taggingCategory()
  30. {
  31. $response = json_decode(file_get_contents(public_path() . '/test.json'));
  32. if ($response->success == true) {
  33. foreach ($response->data as $key => $r) {
  34. $work_order = WorkOrder::where('wo', $r->wo)->first();
  35. if (!empty($work_order)) {
  36. $form_submitted = Form::where('_id', $work_order->_id)->first();
  37. $form_submitted->customer_category = $r->category;
  38. $form_submitted->save();
  39. }
  40. }
  41. return 'data inserted ';
  42. }
  43. }
  44. public function updatePromoPrice()
  45. {
  46. $product = Product::where('formT', 'R')->where('speed', '50')->first();
  47. $product->promotion_price = "69";
  48. $product->save();
  49. $product1 = Product::where('formT','R')->where('speed','100')->first();
  50. $product1->promotion_price = "89";
  51. $product1->save();
  52. $product2 = Product::where('formT', 'R')->where('speed', '500')->first();
  53. $product2->promotion_price = "129";
  54. $product2->save();
  55. $product3 = Product::where('formT', 'B')->where('speed', '50')->first();
  56. $product3->promotion_price = "89";
  57. $product3->save();
  58. $product4 = Product::where('formT', 'B')->where('speed', '100')->first();
  59. $product4->promotion_price = "119";
  60. $product4->save();
  61. $product5 = Product::where('formT', 'B')->where('speed', '300')->first();
  62. $product5->promotion_price = "179";
  63. $product5->save();
  64. $product6 = Product::where('formT', 'B')->where('speed', '500')->first();
  65. $product6->promotion_price = "249";
  66. $product6->save();
  67. return 'promo price update';
  68. }
  69. public function deleteTodayClaim(){
  70. $claim = DealerClaim::where('activated_my', '12/2020')->get();
  71. foreach ($claim as $key => $c) {
  72. # code...
  73. $c->delete();
  74. }
  75. return 'done delete';
  76. }}