public function enrichment_function(SignalsRequest $request) { $username = $request->username; $device = $request->device_id; $video_id = $request->video_id; $action_type = $request->action; //return $action_type; switch ($action_type) { //case click enrichment case '3': $user_action = UserAction::create($request->all()); $get_importance = Action::where('id', $request->action)->first(); $importance = $get_importance->importance; $user_action->update(array('weight' => 1, 'importance' => $importance)); $response = ["message" => 'Enrichment Saved']; $statusCode = 200; return response($response, $statusCode)->header('Content-Type', 'application/json'); //case share enrichment //case share enrichment case '5': $user_action = UserAction::create($request->all()); $get_importance = Action::where('id', $request->action)->first(); $importance = $get_importance->importance; $user_action->update(array('weight' => 1, 'importance' => $importance)); $response = ["message" => 'Enrichment shared']; $statusCode = 200; return response($response, $statusCode)->header('Content-Type', 'application/json'); default: $response = ["message" => 'Action field is required']; return response($response, 400)->header('Content-Type', 'application/json'); } }
public function ad_function(SignalsRequest $request) { $user_action = UserAction::create($request->all()); $get_importance = Action::where('id', $request->action)->first(); $importance = $get_importance->importance; $user_action->update(array('weight' => 1, 'importance' => $importance)); $response = 'Ad Saved'; $statusCode = 200; return response($response, $statusCode)->header('Content-Type', 'application/json'); }