Field cleanup and some field details
This commit is contained in:
@@ -2,14 +2,16 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Cache;
|
||||
use Flash;
|
||||
use Response;
|
||||
use Illuminate\Http\Request;
|
||||
use Prettus\Repository\Criteria\RequestCriteria;
|
||||
|
||||
use App\Http\Requests\CreateRankRequest;
|
||||
use App\Http\Requests\UpdateRankRequest;
|
||||
use App\Repositories\RankRepository;
|
||||
use App\Repositories\SubfleetRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use Flash;
|
||||
use Prettus\Repository\Criteria\RequestCriteria;
|
||||
use Response;
|
||||
|
||||
class RankController extends BaseController
|
||||
{
|
||||
@@ -19,8 +21,7 @@ class RankController extends BaseController
|
||||
public function __construct(
|
||||
RankRepository $rankingRepo,
|
||||
SubfleetRepository $subfleetRepo
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->rankRepository = $rankingRepo;
|
||||
$this->subfleetRepo = $subfleetRepo;
|
||||
}
|
||||
|
||||
@@ -2,19 +2,20 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Requests;
|
||||
use App\Models\Airline;
|
||||
use App\Models\Subfleet;
|
||||
use App\Http\Requests\CreateSubfleetRequest;
|
||||
use App\Http\Requests\UpdateSubfleetRequest;
|
||||
use App\Models\Fare;
|
||||
use App\Repositories\FareRepository;
|
||||
use App\Repositories\SubfleetRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use Flash;
|
||||
use Prettus\Repository\Criteria\RequestCriteria;
|
||||
use Response;
|
||||
|
||||
use App\Models\Enums\FuelType;
|
||||
|
||||
use App\Models\Airline;
|
||||
use App\Models\Subfleet;
|
||||
use App\Http\Requests\CreateSubfleetRequest;
|
||||
use App\Http\Requests\UpdateSubfleetRequest;
|
||||
use App\Repositories\FareRepository;
|
||||
use App\Repositories\SubfleetRepository;
|
||||
|
||||
class SubfleetController extends BaseController
|
||||
{
|
||||
/** @var SubfleetRepository */
|
||||
@@ -34,19 +35,6 @@ class SubfleetController extends BaseController
|
||||
$this->fareRepo = $fareRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getFuelTypes()
|
||||
{
|
||||
$retval = [];
|
||||
foreach (config('enums.fuel_types') as $fuel_type => $value) {
|
||||
$retval[$value] = $fuel_type;
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the fares that haven't been assigned to a given subfleet
|
||||
*/
|
||||
@@ -67,9 +55,9 @@ class SubfleetController extends BaseController
|
||||
|
||||
/**
|
||||
* Display a listing of the Subfleet.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @throws \Prettus\Repository\Exceptions\RepositoryException
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
@@ -90,7 +78,7 @@ class SubfleetController extends BaseController
|
||||
{
|
||||
return view('admin.subfleets.create', [
|
||||
'airlines' => Airline::all()->pluck('name', 'id'),
|
||||
'fuel_types' => $this->getFuelTypes(),
|
||||
'fuel_types' => FuelType::labels(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -152,9 +140,9 @@ class SubfleetController extends BaseController
|
||||
$avail_fares = $this->getAvailFares($subfleet);
|
||||
return view('admin.subfleets.edit', [
|
||||
'airlines' => Airline::all()->pluck('name', 'id'),
|
||||
'fuel_types' => $this->getFuelTypes(),
|
||||
'avail_fares' => $avail_fares,
|
||||
'subfleet' => $subfleet,
|
||||
'fuel_types' => FuelType::labels(),
|
||||
'avail_fares' => $avail_fares,
|
||||
'subfleet' => $subfleet,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,4 +41,21 @@ class EnumBase
|
||||
|
||||
return $labels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select box
|
||||
*/
|
||||
public static function select($add_blank=false)
|
||||
{
|
||||
$labels = [];
|
||||
if($add_blank) {
|
||||
$labels[] = '';
|
||||
}
|
||||
|
||||
foreach (static::$labels as $key => $label) {
|
||||
$labels[$key] = trans($label);
|
||||
}
|
||||
|
||||
return $labels;
|
||||
}
|
||||
}
|
||||
|
||||
16
app/Models/Enums/FuelType.php
Normal file
16
app/Models/Enums/FuelType.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Enums;
|
||||
|
||||
class FuelType extends EnumBase {
|
||||
|
||||
const LOW_LEAD = 0;
|
||||
const JET_A = 1;
|
||||
const MOGAS = 2;
|
||||
|
||||
protected static $labels = [
|
||||
FuelType::LOW_LEAD => '100LL',
|
||||
FuelType::JET_A => 'JET A',
|
||||
FuelType::MOGAS => 'MOGAS',
|
||||
];
|
||||
}
|
||||
@@ -34,10 +34,6 @@ class AcarsRepository extends BaseRepository //implements CacheableInterface
|
||||
return Pirep::with(['airline', 'position'])
|
||||
->where(['state' => PirepState::IN_PROGRESS])
|
||||
->get();
|
||||
|
||||
/*return Pirep::with(['acars' => function($q) {
|
||||
return $q->limit(1);
|
||||
}])->where(['state' => PirepState::IN_PROGRESS])->get();*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user