| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
-
- namespace App\Http\Controllers;
-
- use App\Model\DealerClaim;
- use App\Model\Form;
- use App\Model\Product;
- use App\Model\Subscriber;
- use App\Model\WorkOrder;
- use Carbon\Carbon;
- use Illuminate\Foundation\Bus\DispatchesJobs;
- use Illuminate\Routing\Controller as BaseController;
- use Illuminate\Foundation\Validation\ValidatesRequests;
- use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
-
- class Controller extends BaseController
- {
- use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
-
- public function updateCity()
- {
- $subscribers = Subscriber::all();
-
- foreach ($subscribers as $key => $a) {
- $a->unit_no = strtoupper($a->unit_no);
- $a->building_name = strtoupper($a->building_name);
- $a->street = strtoupper($a->street);
- $a->city = strtoupper($a->city);
- $a->state = strtoupper($a->state);
- $a->save();
- }
-
- return "Done standardize city in DB";
- }
-
- public function taggingCategory()
- {
- $response = json_decode(file_get_contents(public_path() . '/test.json'));
-
- if ($response->success == true) {
-
- foreach ($response->data as $key => $r) {
- $work_order = WorkOrder::where('wo', $r->wo)->first();
-
- if (!empty($work_order)) {
- $form_submitted = Form::where('_id', $work_order->_id)->first();
-
- $form_submitted->customer_category = $r->category;
- $form_submitted->save();
- }
- }
-
- return 'data inserted ';
- }
- }
-
- public function updatePromoPrice()
- {
- $product = Product::where('formT', 'R')->where('speed', '50')->first();
- $product->promotion_price = "69";
- $product->save();
-
- $product1 = Product::where('formT','R')->where('speed','100')->first();
- $product1->promotion_price = "89";
- $product1->save();
-
- $product2 = Product::where('formT', 'R')->where('speed', '500')->first();
- $product2->promotion_price = "129";
- $product2->save();
-
- $product3 = Product::where('formT', 'B')->where('speed', '50')->first();
- $product3->promotion_price = "89";
- $product3->save();
-
- $product4 = Product::where('formT', 'B')->where('speed', '100')->first();
- $product4->promotion_price = "119";
- $product4->save();
-
- $product5 = Product::where('formT', 'B')->where('speed', '300')->first();
- $product5->promotion_price = "179";
- $product5->save();
-
- $product6 = Product::where('formT', 'B')->where('speed', '500')->first();
- $product6->promotion_price = "249";
- $product6->save();
-
- return 'promo price update';
- }
-
- public function deleteTodayClaim(){
- $claim = DealerClaim::where('activated_my', '12/2020')->get();
-
- foreach ($claim as $key => $c) {
- # code...
- $c->delete();
- }
-
- return 'done delete';
- }}
|