Fix tests and docs/better checks #130

This commit is contained in:
Nabeel Shahzad
2018-03-02 17:29:11 -06:00
parent 2df09c533b
commit 586769fbf0
14 changed files with 132 additions and 20 deletions

View File

@@ -13,13 +13,16 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName;
/**
* Class Pirep
*
* @property string flight_number
* @property string route_code
* @property string route_leg
* @property integer airline_id
* @property Aircraft aircraft
* @property Airline airline
* @property Airport arr_airport
* @property Airport dep_airport
* @property mixed flight_number
* @property mixed route_code
* @property mixed route_leg
* @property integer flight_time In minutes
* @property User user
* @package App\Models
*/
class Pirep extends BaseModel
@@ -221,7 +224,7 @@ class Pirep extends BaseModel
* Do some cleanup on the route
* @param $route
*/
public function setRouteAttribute($route)
public function setRouteAttribute($route): void
{
$route = strtoupper(trim($route));
$this->attributes['route'] = $route;
@@ -231,7 +234,7 @@ class Pirep extends BaseModel
* Check if this PIREP is allowed to be updated
* @return bool
*/
public function allowedUpdates()
public function allowedUpdates(): bool
{
if($this->state === PirepState::CANCELLED) {
return false;
@@ -321,7 +324,9 @@ class Pirep extends BaseModel
public function transactions()
{
return $this->hasMany(JournalTransaction::class, 'ref_class_id')
->where('ref_class', __CLASS__);
->where('ref_class', __CLASS__)
->orderBy('credit', 'desc')
->orderBy('debit', 'desc');
}
public function user()