Add helper field() method to Pirep model

This commit is contained in:
Nabeel Shahzad
2018-03-20 11:46:48 -05:00
parent 712cb185b4
commit a9454c319a
2 changed files with 24 additions and 6 deletions

View File

@@ -5,15 +5,16 @@ namespace App\Models;
use App\Interfaces\Model;
use App\Models\Traits\HashIdTrait;
use App\Support\Units\Distance;
use Illuminate\Support\Collection;
use PhpUnitsOfMeasure\Exception\NonNumericValue;
use PhpUnitsOfMeasure\Exception\NonStringUnitName;
/**
* @property Airline airline
* @property mixed flight_number
* @property mixed route_code
* @property mixed route_leg
* @property FlightFields[] fields
* @property Airline airline
* @property mixed flight_number
* @property mixed route_code
* @property mixed route_leg
* @property Collection fields
*/
class Flight extends Model
{
@@ -127,7 +128,7 @@ class Flight extends Model
* @param $field_name
* @return string
*/
public function field($field_name)
public function field($field_name): string
{
$field = $this->fields->where('name', $field_name)->first();
if($field) {