您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Controller.php 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 updateAddress()
  17. {
  18. $subscribers = Subscriber::all();
  19. foreach ($subscribers as $key => $a) {
  20. if($a->unit_no != '' || $a->unit_no != null){
  21. $a->unit_no = strtoupper($a->unit_no);
  22. }
  23. if ($a->building_name != '' || $a->building_name != null) {
  24. $a->building_name = strtoupper($a->building_name);
  25. }
  26. if ($a->street != '' || $a->street != null) {
  27. $a->street = strtoupper($a->street);
  28. }
  29. if ($a->city != ''|| $a->city != null) {
  30. $a->city = strtoupper($a->city);
  31. }
  32. if ($a->state != ''|| $a->state != null) {
  33. $a->state = strtoupper($a->state);
  34. }
  35. $a->save();
  36. }
  37. return "Done standardize city in DB";
  38. }
  39. public function taggingCategory()
  40. {
  41. $response = json_decode(file_get_contents(public_path() . '/test.json'));
  42. if ($response->success == true) {
  43. foreach ($response->data as $key => $r) {
  44. $work_order = WorkOrder::where('wo', $r->wo)->first();
  45. if (!empty($work_order)) {
  46. $form_submitted = Form::where('_id', $work_order->_id)->first();
  47. $form_submitted->customer_category = $r->category;
  48. $form_submitted->save();
  49. }
  50. }
  51. return 'data inserted ';
  52. }
  53. }
  54. public function updatePromoPrice()
  55. {
  56. $product = Product::where('formT', 'R')->where('speed', '50')->first();
  57. $product->promotion_price = "69";
  58. $product->save();
  59. $product1 = Product::where('formT','R')->where('speed','100')->first();
  60. $product1->promotion_price = "89";
  61. $product1->save();
  62. $product2 = Product::where('formT', 'R')->where('speed', '500')->first();
  63. $product2->promotion_price = "129";
  64. $product2->save();
  65. $product3 = Product::where('formT', 'B')->where('speed', '50')->first();
  66. $product3->promotion_price = "89";
  67. $product3->save();
  68. $product4 = Product::where('formT', 'B')->where('speed', '100')->first();
  69. $product4->promotion_price = "119";
  70. $product4->save();
  71. $product5 = Product::where('formT', 'B')->where('speed', '300')->first();
  72. $product5->promotion_price = "179";
  73. $product5->save();
  74. $product6 = Product::where('formT', 'B')->where('speed', '500')->first();
  75. $product6->promotion_price = "249";
  76. $product6->save();
  77. return 'promo price update';
  78. }
  79. public function deleteTodayClaim(){
  80. $claim = DealerClaim::where('activated_my', '12/2020')->get();
  81. foreach ($claim as $key => $c) {
  82. # code...
  83. $c->delete();
  84. }
  85. return 'done delete';
  86. }}