set fare classes on aircraft w/ overrides (no admin ui yet)
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\AircraftClass;
|
||||
use InfyOm\Generator\Common\BaseRepository;
|
||||
|
||||
class AircraftClassRepository extends BaseRepository
|
||||
{
|
||||
|
||||
@@ -3,20 +3,20 @@
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\Aircraft;
|
||||
use InfyOm\Generator\Common\BaseRepository;
|
||||
|
||||
class AircraftRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fieldSearchable = [
|
||||
'icao',
|
||||
'name',
|
||||
'full_name',
|
||||
'registration',
|
||||
'active',
|
||||
];
|
||||
protected $fieldSearchable
|
||||
= [
|
||||
'icao',
|
||||
'name',
|
||||
'full_name',
|
||||
'registration',
|
||||
'active',
|
||||
];
|
||||
|
||||
/**
|
||||
* Configure the Model
|
||||
@@ -25,4 +25,9 @@ class AircraftRepository extends BaseRepository
|
||||
{
|
||||
return Aircraft::class;
|
||||
}
|
||||
|
||||
public function findByICAO($icao)
|
||||
{
|
||||
return $this->findByField('icao', $icao)->first();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\Airlines;
|
||||
use InfyOm\Generator\Common\BaseRepository;
|
||||
|
||||
class AirlinesRepository extends BaseRepository
|
||||
{
|
||||
|
||||
21
app/Repositories/BaseRepository.php
Normal file
21
app/Repositories/BaseRepository.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
abstract class BaseRepository extends \InfyOm\Generator\Common\BaseRepository {
|
||||
|
||||
public function validate($values) {
|
||||
$validator = Validator::make(
|
||||
$values,
|
||||
$this->model()->rules
|
||||
);
|
||||
|
||||
if($validator->fails()) {
|
||||
return $validator->messages();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
32
app/Repositories/FareRepository.php
Normal file
32
app/Repositories/FareRepository.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\Fare;
|
||||
|
||||
class FareRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fieldSearchable = [
|
||||
'code',
|
||||
'name',
|
||||
'price',
|
||||
'cost',
|
||||
'notes',
|
||||
'active'
|
||||
];
|
||||
|
||||
/**
|
||||
* Configure the Model
|
||||
**/
|
||||
public function model()
|
||||
{
|
||||
return Fare::class;
|
||||
}
|
||||
|
||||
public function findByCode($code) {
|
||||
return $this->findByField('code', $code)->first();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user