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.

Controller.php 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Model\DealerClaim;
  4. use App\Model\Docket;
  5. use App\Model\Form;
  6. use App\Model\PackageDetail;
  7. use App\Model\Product;
  8. use App\Model\StaffDetail;
  9. use App\Model\Subscriber;
  10. use App\Model\WorkOrder;
  11. use App\Staff;
  12. use Illuminate\Foundation\Bus\DispatchesJobs;
  13. use Illuminate\Routing\Controller as BaseController;
  14. use Illuminate\Foundation\Validation\ValidatesRequests;
  15. use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
  16. use Illuminate\Http\Request;
  17. class Controller extends BaseController
  18. {
  19. use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
  20. public function updateAddress()
  21. {
  22. $subscribers = Subscriber::all();
  23. foreach ($subscribers as $key => $a) {
  24. if ($a->unit_no != '' || $a->unit_no != null) {
  25. $a->unit_no = strtoupper($a->unit_no);
  26. }
  27. if ($a->building_name != '' || $a->building_name != null) {
  28. $a->building_name = strtoupper($a->building_name);
  29. }
  30. if ($a->street != '' || $a->street != null) {
  31. $a->street = strtoupper($a->street);
  32. }
  33. if ($a->city != '' || $a->city != null) {
  34. $a->city = strtoupper($a->city);
  35. }
  36. if ($a->state != '' || $a->state != null) {
  37. $a->state = strtoupper($a->state);
  38. }
  39. $a->save();
  40. }
  41. return "Done standardize city in DB";
  42. }
  43. public function taggingCategory()
  44. {
  45. $response = json_decode(file_get_contents(public_path() . '/test.json'));
  46. if ($response->success == true) {
  47. foreach ($response->data as $key => $r) {
  48. $work_order = WorkOrder::where('wo', $r->wo)->first();
  49. if (!empty($work_order)) {
  50. $form_submitted = Form::where('_id', $work_order->_id)->first();
  51. $form_submitted->customer_category = $r->category;
  52. $form_submitted->save();
  53. }
  54. }
  55. return 'data inserted ';
  56. }
  57. }
  58. public function updatePromoPrice()
  59. {
  60. $product = Product::where('formT', 'R')->where('speed', '50')->first();
  61. $product->promotion_price = "69";
  62. $product->save();
  63. $product1 = Product::where('formT', 'R')->where('speed', '100')->first();
  64. $product1->promotion_price = "89";
  65. $product1->save();
  66. $product2 = Product::where('formT', 'R')->where('speed', '500')->first();
  67. $product2->promotion_price = "129";
  68. $product2->save();
  69. $product3 = Product::where('formT', 'B')->where('speed', '50')->first();
  70. $product3->promotion_price = "89";
  71. $product3->save();
  72. $product4 = Product::where('formT', 'B')->where('speed', '100')->first();
  73. $product4->promotion_price = "119";
  74. $product4->save();
  75. $product5 = Product::where('formT', 'B')->where('speed', '300')->first();
  76. $product5->promotion_price = "179";
  77. $product5->save();
  78. $product6 = Product::where('formT', 'B')->where('speed', '500')->first();
  79. $product6->promotion_price = "249";
  80. $product6->save();
  81. return 'promo price update';
  82. }
  83. public function resetDocket(Request $request)
  84. {
  85. $docket = Docket::where('docket_id', $request->docket_id)->first();
  86. $work_order = WorkOrder::where('wo', $docket->work_order_id)->first();
  87. $work_order->docket_id = "";
  88. $work_order->status = "Pending Installer";
  89. $work_order->save();
  90. $claim = DealerClaim::where('docket', $request->docket_id)->first();
  91. if (!empty($claim)) {
  92. $claim->forceDelete();
  93. }
  94. $docket->forceDelete();
  95. }
  96. public function getDatabase(Request $request)
  97. {
  98. $work_order = WorkOrder::where('wo','W0-15622')->first();
  99. $work_order->forceDelete();
  100. }
  101. }