#21 PIREP scaffolding

This commit is contained in:
Nabeel Shahzad
2017-06-28 19:56:10 -05:00
parent cd5f58b0a1
commit fc1220178b
8 changed files with 95 additions and 3 deletions

View File

@@ -14,3 +14,5 @@ DB_USERNAME=
DB_PASSWORD=
CACHE_DRIVER=array
PHPVMS_CURRENCY=dollar

8
.htaccess Normal file
View File

@@ -0,0 +1,8 @@
# Disable index view
Options -Indexes
# Hide a specific file
<Files .env>
Order allow,deny
Deny from all
</Files>

View File

@@ -53,6 +53,7 @@ class Aircraft extends Model
/**
* foreign keys
*/
public function airport()
{
return $this->belongsTo('App\Models\Airport', 'airport_id');

View File

@@ -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');
}
}

View 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;
}
}

View 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;
}
}

View File

@@ -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() {

View File

@@ -13,6 +13,8 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/phenx/php-font-lib" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phenx/php-svg-lib" />
<excludeFolder url="file://$MODULE_DIR$/vendor/phpoffice/phpexcel" />
<excludeFolder url="file://$MODULE_DIR$/vendor/spatie/fractalistic" />
<excludeFolder url="file://$MODULE_DIR$/vendor/spatie/laravel-fractal" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php56" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-util" />
<excludeFolder url="file://$MODULE_DIR$/vendor/webpatser/laravel-uuid" />
@@ -44,6 +46,8 @@
<root url="file://$MODULE_DIR$/vendor/phenx/php-font-lib" />
<root url="file://$MODULE_DIR$/vendor/phenx/php-svg-lib" />
<root url="file://$MODULE_DIR$/vendor/phpoffice/phpexcel" />
<root url="file://$MODULE_DIR$/vendor/spatie/fractalistic" />
<root url="file://$MODULE_DIR$/vendor/spatie/laravel-fractal" />
<root url="file://$MODULE_DIR$/vendor/symfony/polyfill-php56" />
<root url="file://$MODULE_DIR$/vendor/symfony/polyfill-util" />
<root url="file://$MODULE_DIR$/vendor/webpatser/laravel-uuid" />
@@ -62,6 +66,8 @@
<root url="file://$MODULE_DIR$/vendor/phenx/php-font-lib" />
<root url="file://$MODULE_DIR$/vendor/phenx/php-svg-lib" />
<root url="file://$MODULE_DIR$/vendor/phpoffice/phpexcel" />
<root url="file://$MODULE_DIR$/vendor/spatie/fractalistic" />
<root url="file://$MODULE_DIR$/vendor/spatie/laravel-fractal" />
<root url="file://$MODULE_DIR$/vendor/symfony/polyfill-php56" />
<root url="file://$MODULE_DIR$/vendor/symfony/polyfill-util" />
<root url="file://$MODULE_DIR$/vendor/webpatser/laravel-uuid" />