diff --git a/app/Http/Controllers/Admin/SubfleetController.php b/app/Http/Controllers/Admin/SubfleetController.php
index 6fcc8b52..8d930ef3 100644
--- a/app/Http/Controllers/Admin/SubfleetController.php
+++ b/app/Http/Controllers/Admin/SubfleetController.php
@@ -20,6 +20,16 @@ class SubfleetController extends BaseController
/** @var SubfleetRepository */
private $subfleetRepo, $fareRepo;
+ protected function getFuelTypes()
+ {
+ $retval = [];
+ foreach (config('enums.fuel_types') as $fuel_type => $value) {
+ $retval[$value] = $fuel_type;
+ }
+
+ return $retval;
+ }
+
protected function getAvailFares($subfleet)
{
$retval = [];
@@ -69,6 +79,7 @@ class SubfleetController extends BaseController
{
return view('admin.subfleets.create', [
'airlines' => Airline::all()->pluck('name', 'id'),
+ 'fuel_types' => $this->getFuelTypes(),
]);
}
@@ -130,6 +141,7 @@ 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,
]);
diff --git a/app/Models/Subfleet.php b/app/Models/Subfleet.php
index 1586487e..318c0a1c 100644
--- a/app/Models/Subfleet.php
+++ b/app/Models/Subfleet.php
@@ -3,7 +3,6 @@
namespace App\Models;
use Eloquent as Model;
-use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class Subfleet
@@ -11,18 +10,14 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*/
class Subfleet extends Model
{
- use SoftDeletes;
-
public $table = 'subfleets';
-
-
protected $dates = ['deleted_at'];
-
public $fillable = [
'airline_id',
'name',
- 'type'
+ 'type',
+ 'fuel_type',
];
/**
@@ -32,8 +27,7 @@ class Subfleet extends Model
*/
protected $casts = [
'airline_id' => 'integer',
- 'name' => 'string',
- 'type' => 'string'
+ 'fuel_type' => 'integer',
];
/**
diff --git a/database/migrations/2017_06_23_011011_create_subfleets_table.php b/database/migrations/2017_06_23_011011_create_subfleets_table.php
index 10cebcf8..ff9331fa 100644
--- a/database/migrations/2017_06_23_011011_create_subfleets_table.php
+++ b/database/migrations/2017_06_23_011011_create_subfleets_table.php
@@ -18,10 +18,10 @@ class CreateSubfleetsTable extends Migration
$table->integer('airline_id')->unsigned()->nullable();
$table->string('name');
$table->text('type');
+ $table->tinyInteger('fuel_type')->unsigned()->nullable();
$table->double('cargo_capacity', 19, 2)->nullable();
$table->double('fuel_capacity', 19, 2)->nullable();
$table->double('gross_weight', 19, 2)->nullable();
- $table->tinyInteger('fuel_type')->unsigned()->nullable();
$table->timestamps();
$table->softDeletes();
});
diff --git a/resources/views/admin/app.blade.php b/resources/views/admin/app.blade.php
index f2048764..16fb5fc9 100644
--- a/resources/views/admin/app.blade.php
+++ b/resources/views/admin/app.blade.php
@@ -194,6 +194,11 @@
{{-- --}}
+
@yield('scripts')