67 lines
2.2 KiB
PHP
67 lines
2.2 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class Airline
|
|
*
|
|
* @property int $id
|
|
* @property string $name
|
|
* @property string $name_full
|
|
* @property Carbon $created_at
|
|
* @property Carbon $updated_at
|
|
* @package App\Models
|
|
* @property array|null $contact_emails
|
|
* @property array|null $emails
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereContactEmails($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereEmails($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereName($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereNameFull($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Airline whereUpdatedAt($value)
|
|
* @property string|null $flight_info
|
|
* @property string|null $check_in
|
|
* @property string|null $baggage
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Airline whereBaggage($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Airline whereCheckIn($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Airline whereFlightInfo($value)
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Airline extends Model
|
|
{
|
|
protected $connection = 'mysql';
|
|
|
|
protected $table = 'airlines';
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'name_full',
|
|
'emails',
|
|
'contact_emails',
|
|
'flight_info',
|
|
'check_in',
|
|
'baggage',
|
|
];
|
|
|
|
protected $casts = ['contact_emails' => 'array'];
|
|
|
|
public static function getAsNameIdArray($empty = true){
|
|
$ret = Airline::get()->pluck('name', 'id')->toArray();
|
|
if($empty){
|
|
$first = [null => "-"];
|
|
return $first + $ret;
|
|
}
|
|
return $ret;
|
|
}
|
|
}
|