#21 PIREP scaffolding
This commit is contained in:
@@ -53,6 +53,7 @@ class Aircraft extends Model
|
||||
/**
|
||||
* foreign keys
|
||||
*/
|
||||
|
||||
public function airport()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Airport', 'airport_id');
|
||||
|
||||
@@ -51,4 +51,28 @@ class User extends Authenticatable
|
||||
protected $hidden = [
|
||||
'password', 'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* Foreign Keys
|
||||
*/
|
||||
|
||||
public function airline()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Airline', 'airline_id');
|
||||
}
|
||||
|
||||
public function home_airport()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Airport', 'home_airport_id');
|
||||
}
|
||||
|
||||
public function current_airport()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Airport', 'curr_airport_id');
|
||||
}
|
||||
|
||||
public function rank()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Rank', 'rank_id');
|
||||
}
|
||||
}
|
||||
|
||||
24
app/Repositories/PirepFieldRepository.php
Normal file
24
app/Repositories/PirepFieldRepository.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\PirepField;
|
||||
use InfyOm\Generator\Common\BaseRepository;
|
||||
|
||||
class PirepFieldRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fieldSearchable = [
|
||||
'name'
|
||||
];
|
||||
|
||||
/**
|
||||
* Configure the Model
|
||||
**/
|
||||
public function model()
|
||||
{
|
||||
return PirepField::class;
|
||||
}
|
||||
}
|
||||
24
app/Repositories/PirepRepository.php
Normal file
24
app/Repositories/PirepRepository.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\Pirep;
|
||||
use InfyOm\Generator\Common\BaseRepository;
|
||||
|
||||
class PirepRepository extends BaseRepository
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $fieldSearchable = [
|
||||
'user_id'
|
||||
];
|
||||
|
||||
/**
|
||||
* Configure the Model
|
||||
**/
|
||||
public function model()
|
||||
{
|
||||
return Pirep::class;
|
||||
}
|
||||
}
|
||||
@@ -2,20 +2,23 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Repositories\PirepRepository;
|
||||
use App\Repositories\SubfleetRepository;
|
||||
|
||||
|
||||
class PIREPService extends BaseService {
|
||||
|
||||
protected $aircraft;
|
||||
protected $aircraftRepo, $pirepRepo;
|
||||
|
||||
/**
|
||||
* return a PIREP model
|
||||
*/
|
||||
public function __construct(
|
||||
SubfleetRepository $aircraft
|
||||
SubfleetRepository $aircraftRepo,
|
||||
PirepRepository $pirepRepo
|
||||
) {
|
||||
$this->aircraft = $aircraft;
|
||||
$this->aircraftRepo = $aircraftRepo;
|
||||
$this->pirepRepo = $pirepRepo;
|
||||
}
|
||||
|
||||
public function create() {
|
||||
|
||||
Reference in New Issue
Block a user