phpvms/app/Models/Expense.php
Nabeel S 12848091a2
Laravel 9 Update (#1413)
Update to Laravel 9 and PHP 8+

Co-authored-by: B.Fatih KOZ <fatih.koz@gmail.com>
2022-03-14 11:45:18 -04:00

68 lines
1.4 KiB
PHP

<?php
namespace App\Models;
use App\Contracts\Model;
use App\Models\Casts\CommaDelimitedCast;
use App\Models\Traits\ReferenceTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;
/**
* @property int airline_id
* @property float amount
* @property string name
* @property string type
* @property string flight_type
* @property string ref_model
* @property string ref_model_id
* @property bool charge_to_user
* @property Airline $airline
*
* @mixin \Illuminate\Database\Eloquent\Builder
*/
class Expense extends Model
{
use HasFactory;
use ReferenceTrait;
public $table = 'expenses';
protected $fillable = [
'airline_id',
'name',
'amount',
'type',
'flight_type',
'multiplier',
'charge_to_user',
'ref_model',
'ref_model_id',
'active',
];
public $casts = [
'flight_type' => CommaDelimitedCast::class,
];
public static $rules = [
'active' => 'bool',
'airline_id' => 'integer',
'amount' => 'float',
'multiplier' => 'bool',
'charge_to_user' => 'bool',
];
/**
* Foreign Keys
*/
public function airline()
{
return $this->belongsTo(Airline::class, 'airline_id');
}
public function ref_model()
{
return $this->morphTo();
}
}