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. use Mockery\Matcher\Subset;
  18. class Controller extends BaseController
  19. {
  20. use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
  21. public function updateAddress()
  22. {
  23. $subscribers = Subscriber::all();
  24. foreach ($subscribers as $key => $a) {
  25. if ($a->unit_no != '' || $a->unit_no != null) {
  26. $a->unit_no = strtoupper($a->unit_no);
  27. }
  28. if ($a->building_name != '' || $a->building_name != null) {
  29. $a->building_name = strtoupper($a->building_name);
  30. }
  31. if ($a->street != '' || $a->street != null) {
  32. $a->street = strtoupper($a->street);
  33. }
  34. if ($a->city != '' || $a->city != null) {
  35. $a->city = strtoupper($a->city);
  36. }
  37. if ($a->state != '' || $a->state != null) {
  38. $a->state = strtoupper($a->state);
  39. }
  40. $a->save();
  41. }
  42. return "Done standardize city in DB";
  43. }
  44. public function standardizeAddress()
  45. {
  46. $response = json_decode(file_get_contents(public_path() . '/test.json'));
  47. if ($response->success == true) {
  48. foreach ($response->data as $key => $r) {
  49. $subscriber = Subscriber::where('subscriber_id', $r->subscriber_id)->first();
  50. if (!empty($subscriber)) {
  51. $subscriber->city = $r->city;
  52. $subscriber->state = $r->state;
  53. $subscriber->save();
  54. }
  55. }
  56. return count($response);
  57. }
  58. }
  59. public function updatePromoPrice()
  60. {
  61. $product = Product::where('formT', 'R')->where('speed', '50')->first();
  62. $product->promotion_price = "69";
  63. $product->save();
  64. $product1 = Product::where('formT', 'R')->where('speed', '100')->first();
  65. $product1->promotion_price = "89";
  66. $product1->save();
  67. $product2 = Product::where('formT', 'R')->where('speed', '500')->first();
  68. $product2->promotion_price = "129";
  69. $product2->save();
  70. $product3 = Product::where('formT', 'B')->where('speed', '50')->first();
  71. $product3->promotion_price = "89";
  72. $product3->save();
  73. $product4 = Product::where('formT', 'B')->where('speed', '100')->first();
  74. $product4->promotion_price = "119";
  75. $product4->save();
  76. $product5 = Product::where('formT', 'B')->where('speed', '300')->first();
  77. $product5->promotion_price = "179";
  78. $product5->save();
  79. $product6 = Product::where('formT', 'B')->where('speed', '500')->first();
  80. $product6->promotion_price = "249";
  81. $product6->save();
  82. return 'promo price update';
  83. }
  84. public function resetDocket(Request $request)
  85. {
  86. $docket = Docket::where('docket_id', $request->docket_id)->first();
  87. $work_order = WorkOrder::where('wo', $docket->work_order_id)->first();
  88. $work_order->docket_id = "";
  89. $work_order->status = "Pending Installer";
  90. $work_order->save();
  91. $claim = DealerClaim::where('docket', $request->docket_id)->first();
  92. if (!empty($claim)) {
  93. $claim->forceDelete();
  94. }
  95. $docket->forceDelete();
  96. }
  97. public function getDatabase(Request $request)
  98. {
  99. $claim = DealerClaim::where('projectT',null)->orWhere('projectT','null')->get();
  100. return $claim;
  101. }
  102. }