#21 base code for accepting/rejecting PIREPs
This commit is contained in:
@@ -29,6 +29,7 @@ class Pirep extends Model
|
||||
'route_leg',
|
||||
'dpt_airport_id',
|
||||
'arr_airport_id',
|
||||
'source',
|
||||
'level',
|
||||
'route',
|
||||
'notes',
|
||||
@@ -43,14 +44,10 @@ class Pirep extends Model
|
||||
*/
|
||||
protected $casts
|
||||
= [
|
||||
'user_id' => 'integer',
|
||||
'flight_id' => 'string',
|
||||
'aircraft_id' => 'integer',
|
||||
'flight_time' => 'integer',
|
||||
'level' => 'integer',
|
||||
'route' => 'string',
|
||||
'notes' => 'string',
|
||||
'raw_data' => 'string',
|
||||
'source' => 'integer',
|
||||
'status' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -92,6 +89,11 @@ class Pirep extends Model
|
||||
return $this->belongsTo('App\Models\Flight', 'flight_id');
|
||||
}
|
||||
|
||||
public function pilot()
|
||||
{
|
||||
return $this->user();
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\User', 'user_id');
|
||||
|
||||
@@ -11,22 +11,38 @@ use Illuminate\Contracts\Auth\CanResetPassword;
|
||||
/**
|
||||
* App\User
|
||||
*
|
||||
* @property integer $id
|
||||
* @property string $name
|
||||
* @property string $email
|
||||
* @property string $password
|
||||
* @property string $remember_token
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $notifications
|
||||
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[] $unreadNotifications
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereEmail($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\User wherePassword($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereRememberToken($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\User whereUpdatedAt($value)
|
||||
* @property integer
|
||||
* $id
|
||||
* @property string
|
||||
* $name
|
||||
* @property string
|
||||
* $email
|
||||
* @property string
|
||||
* $password
|
||||
* @property string
|
||||
* $remember_token
|
||||
* @property \Carbon\Carbon
|
||||
* $created_at
|
||||
* @property \Carbon\Carbon
|
||||
* $updated_at
|
||||
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[]
|
||||
* $notifications
|
||||
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection|\Illuminate\Notifications\DatabaseNotification[]
|
||||
* $unreadNotifications
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\User
|
||||
* whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\User
|
||||
* whereName($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\User
|
||||
* whereEmail($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\User
|
||||
* wherePassword($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\User
|
||||
* whereRememberToken($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\User
|
||||
* whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\User
|
||||
* whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class User extends Authenticatable
|
||||
@@ -39,22 +55,35 @@ class User extends Authenticatable
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name', 'email', 'password',
|
||||
];
|
||||
protected $fillable
|
||||
= [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for arrays.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password', 'remember_token',
|
||||
];
|
||||
protected $hidden
|
||||
= [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
protected $casts
|
||||
= [
|
||||
'flights' => 'integer',
|
||||
'flight_hours' => 'integer',
|
||||
'balance' => 'double',
|
||||
'timezone' => 'integer',
|
||||
];
|
||||
|
||||
public function pilot_id()
|
||||
{
|
||||
return $this->airline->code . str_pad($this->id, 3, '0', STR_PAD_LEFT);
|
||||
return $this->airline->code.str_pad($this->id, 3, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user