#57 scaffolding for flight search
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Repositories\FlightRepository;
|
||||
use App\Http\Controllers\AppBaseController;
|
||||
|
||||
@@ -18,8 +19,16 @@ class FlightController extends AppBaseController
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$flights = $this->flightRepo->findByField('active', true);
|
||||
$where = ['active' => true];
|
||||
|
||||
// default restrictions on the flights shown. Handle search differently
|
||||
if (config('phpvms.only_flights_from_current')) {
|
||||
$where['dpt_airport_id'] = Auth::user()->curr_airport_id;
|
||||
}
|
||||
|
||||
// TODO: PAGINATION
|
||||
|
||||
$flights = $this->flightRepo->findWhere($where);
|
||||
return $this->view('flights.index', [
|
||||
'flights' => $flights,
|
||||
]);
|
||||
@@ -30,6 +39,17 @@ class FlightController extends AppBaseController
|
||||
|
||||
}
|
||||
|
||||
public function search(Request $request) {
|
||||
$where = ['active' => true];
|
||||
$flights = $this->flightRepo->findWhere($where);
|
||||
|
||||
// TODO: PAGINATION
|
||||
|
||||
return $this->view('flights.index', [
|
||||
'flights' => $flights,
|
||||
]);
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user