選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Controller.php 2.7KB

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