Cleanup frontend user bid add/remove to use the API, script and html cleanup #172

This commit is contained in:
Nabeel Shahzad
2018-02-22 11:34:57 -06:00
parent 6dfab75f08
commit ad5f36f85e
9 changed files with 88 additions and 108 deletions

View File

@@ -97,41 +97,6 @@ class FlightController extends Controller
]);
}
/**
* @param Request $request
* @return \Illuminate\Http\JsonResponse
* @throws \Exception
*/
public function save(Request $request)
{
$user_id = Auth::id();
$flight_id = $request->input('flight_id');
$action = strtolower($request->input('action'));
$cols = ['user_id' => $user_id, 'flight_id' => $flight_id];
if($action === 'save') {
$uf = UserBid::create($cols);
$uf->save();
return response()->json([
'id' => $uf->id,
'message' => 'Saved!',
]);
}
elseif ($action === 'remove') {
try {
$uf = UserBid::where($cols)->first();
$uf->delete();
} catch (\Exception $e) { }
return response()->json([
'message' => 'Deleted!'
]);
}
}
/**
* Show the flight information page
* @param $id