Add setting to automatically remove bid on PIREP accept #200
This commit is contained in:
@@ -23,6 +23,8 @@ use PhpUnitsOfMeasure\Exception\NonStringUnitName;
|
||||
* @property Airport dep_airport
|
||||
* @property integer flight_time In minutes
|
||||
* @property User user
|
||||
* @property Flight|null flight
|
||||
* @property int user_id
|
||||
* @package App\Models
|
||||
*/
|
||||
class Pirep extends BaseModel
|
||||
@@ -190,6 +192,29 @@ class Pirep extends BaseModel
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up the flight, based on the PIREP flight info
|
||||
* @return Flight|null
|
||||
*/
|
||||
public function getFlightAttribute()
|
||||
{
|
||||
$where = [
|
||||
'airline_id' => $this->airline_id,
|
||||
'flight_number' => $this->flight_number,
|
||||
'active' => true,
|
||||
];
|
||||
|
||||
if (filled($this->route_code)) {
|
||||
$where['route_code'] = $this->route_code;
|
||||
}
|
||||
|
||||
if (filled($this->route_leg)) {
|
||||
$where['route_leg'] = $this->route_leg;
|
||||
}
|
||||
|
||||
return Flight::where($where)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the amount of fuel used
|
||||
* @param $value
|
||||
|
||||
@@ -22,6 +22,7 @@ use Laratrust\Traits\LaratrustUserTrait;
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property Rank rank
|
||||
* @property Journal journal
|
||||
* @property string pilot_id
|
||||
* @mixin \Illuminate\Notifications\Notifiable
|
||||
* @mixin \Laratrust\Traits\LaratrustUserTrait
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user