ba8a819c7d
- flight ident now use this format: VA IATA(if empty ICAO) + Flight Number + - + Flight Code (without C) + - + Flight Leg (without L) - added function __trans_choice in helpers.php for translation - fixed error in flight edit/insert panel not showing/inserting Tuesday in days - fixed an error occurring when metar retrieved is empty - edited now-ui-kit.css to align login fields correctly - added /public/assets/frontend/js/core/jquery-3.3.1.min.js to fix a missed resource error in authentication pages - added translations file for en and it locales - translated all the frontend templates
96 lines
1.9 KiB
PHP
96 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Interfaces\Model;
|
|
use App\Models\Enums\JournalType;
|
|
use App\Models\Traits\FilesTrait;
|
|
use App\Models\Traits\JournalTrait;
|
|
|
|
/**
|
|
* Class Airline
|
|
* @property mixed id
|
|
* @property string code
|
|
* @property string icao
|
|
* @property string iata
|
|
* @property string name
|
|
* @property string logo
|
|
* @property string country
|
|
* @property Journal journal
|
|
* @package App\Models
|
|
*/
|
|
class Airline extends Model
|
|
{
|
|
use FilesTrait;
|
|
use JournalTrait;
|
|
|
|
public $table = 'airlines';
|
|
|
|
/**
|
|
* The journal type for the callback
|
|
*/
|
|
public $journal_type = JournalType::AIRLINE;
|
|
|
|
protected $fillable = [
|
|
'icao',
|
|
'iata',
|
|
'name',
|
|
'logo',
|
|
'country',
|
|
'total_flights',
|
|
'total_time',
|
|
'active',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be casted to native types.
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'total_flights' => 'int',
|
|
'total_time' => 'int',
|
|
'active' => 'boolean',
|
|
];
|
|
|
|
/**
|
|
* Validation rules
|
|
* @var array
|
|
*/
|
|
public static $rules = [
|
|
'country' => 'nullable',
|
|
'iata' => 'nullable|max:5',
|
|
'icao' => 'required|max:5',
|
|
'logo' => 'nullable',
|
|
'name' => 'required',
|
|
];
|
|
|
|
/**
|
|
* For backwards compatibility
|
|
*/
|
|
public function getCodeAttribute()
|
|
{
|
|
if ($this->iata && $this->iata !== '')
|
|
return $this->iata;
|
|
else
|
|
return $this->icao;
|
|
}
|
|
|
|
/**
|
|
* Capitalize the IATA code when set
|
|
* @param $iata
|
|
*/
|
|
public function setIataAttribute($iata)
|
|
{
|
|
$this->attributes['iata'] = strtoupper($iata);
|
|
}
|
|
|
|
/**
|
|
* Capitalize the ICAO when set
|
|
* @param $icao
|
|
*/
|
|
public function setIcaoAttribute($icao): void
|
|
{
|
|
$this->attributes['icao'] = strtoupper($icao);
|
|
}
|
|
}
|