Rename UserFlight to UserBid to match functionality
This commit is contained in:
@@ -5,7 +5,6 @@ namespace App\Http\Controllers\Api;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Http\Controllers\AppBaseController;
|
||||
use App\Models\Transformers\FlightTransformer;
|
||||
use App\Repositories\FlightRepository;
|
||||
use App\Http\Resources\Flight as FlightResource;
|
||||
use Prettus\Repository\Exceptions\RepositoryException;
|
||||
@@ -33,7 +32,7 @@ class FlightController extends AppBaseController
|
||||
} catch (RepositoryException $e) {
|
||||
return response($e, 503);
|
||||
}
|
||||
|
||||
return FlightResource::collection($flights);
|
||||
//return fractal($flights, new FlightTransformer())->respond();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,23 @@
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Models\Pirep;
|
||||
use App\Models\Transformers\PirepTransformer;
|
||||
use App\Http\Resources\Pirep as PirepResource;
|
||||
use App\Http\Controllers\AppBaseController;
|
||||
use App\Repositories\PirepRepository;
|
||||
|
||||
|
||||
class PirepController extends AppBaseController
|
||||
{
|
||||
protected $pirepRepo;
|
||||
|
||||
public function __construct(PirepRepository $pirepRepo)
|
||||
{
|
||||
$this->pirepRepo = $pirepRepo;
|
||||
}
|
||||
|
||||
public function get($id)
|
||||
{
|
||||
$pirep = Pirep::find($id);
|
||||
return fractal($pirep, new PirepTransformer())->respond();
|
||||
PirepResource::withoutWrapping();
|
||||
return new PirepResource($this->pirepRepo->find($id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
use App\Http\Controllers\AppBaseController;
|
||||
use App\Models\UserFlight;
|
||||
use App\Models\UserBid;
|
||||
use App\Repositories\FlightRepository;
|
||||
use App\Repositories\Criteria\WhereCriteria;
|
||||
|
||||
@@ -48,7 +48,7 @@ class FlightController extends AppBaseController
|
||||
|
||||
$flights = $this->flightRepo->paginate();
|
||||
|
||||
$saved_flights = UserFlight::where('user_id', Auth::id())
|
||||
$saved_flights = UserBid::where('user_id', Auth::id())
|
||||
->pluck('flight_id')->toArray();
|
||||
|
||||
return $this->view('flights.index', [
|
||||
@@ -69,7 +69,7 @@ class FlightController extends AppBaseController
|
||||
{
|
||||
$flights = $this->flightRepo->searchCriteria($request)->paginate();
|
||||
|
||||
$saved_flights = UserFlight::where('user_id', Auth::id())
|
||||
$saved_flights = UserBid::where('user_id', Auth::id())
|
||||
->pluck('flight_id')->toArray();
|
||||
|
||||
return $this->view('flights.index', [
|
||||
@@ -89,7 +89,7 @@ class FlightController extends AppBaseController
|
||||
$cols = ['user_id' => $user_id, 'flight_id' => $flight_id];
|
||||
|
||||
if($action === 'save') {
|
||||
$uf = UserFlight::create($cols);
|
||||
$uf = UserBid::create($cols);
|
||||
$uf->save();
|
||||
|
||||
return response()->json([
|
||||
@@ -100,7 +100,7 @@ class FlightController extends AppBaseController
|
||||
|
||||
elseif ($action === 'remove') {
|
||||
try {
|
||||
$uf = UserFlight::where($cols)->first();
|
||||
$uf = UserBid::where($cols)->first();
|
||||
$uf->delete();
|
||||
} catch (Exception $e) { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user