ソースを参照

add tagging category function

ifah
コミット
8c0b9f18bf
1個のファイルの変更23行の追加0行の削除
  1. 23
    0
      app/Http/Controllers/Controller.php

+ 23
- 0
app/Http/Controllers/Controller.php ファイルの表示

@@ -2,7 +2,9 @@

namespace App\Http\Controllers;

use App\Model\Form;
use App\Model\Subscriber;
use App\Model\WorkOrder;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
@@ -27,4 +29,25 @@ class Controller extends BaseController

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 ';
}
}
}

読み込み中…
キャンセル
保存