84 lines
2.1 KiB
PHP
84 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enumerations\InvoiceStatus;
|
|
use App\Enumerations\InvoiceType;
|
|
use App\Scopes\InstancedModel;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* @property string $tenant
|
|
* @property string $cost_unit_id
|
|
* @property string $invoice_number
|
|
* @property string $status
|
|
* @property string $type
|
|
* @property string $type_other
|
|
* @property boolean $donation
|
|
* @property string $user_id
|
|
* @property string $contact_name
|
|
* @property string $contact_email
|
|
* @property string $contact_phone
|
|
* @property string $contact_bank_owner
|
|
* @property string $contact_bank_iban
|
|
* @property float $amount
|
|
* @property integer $distance
|
|
* @property string $comment
|
|
* @property string $changes
|
|
* @property string $travel_direction
|
|
* @property boolean $passengers
|
|
* @property boolean $transportation
|
|
* @property string $document_filename
|
|
* @property string $approved_by
|
|
* @property string $approved_at
|
|
* @property boolean $upload_required
|
|
* @property string $denied_by
|
|
* @property string $denied_at
|
|
* @property string $denied_reason
|
|
*/
|
|
class Invoice extends InstancedModel
|
|
{
|
|
protected $fillable = [
|
|
'tenant',
|
|
'cost_unit_id',
|
|
'invoice_number',
|
|
'status',
|
|
'type',
|
|
'type_other',
|
|
'donation',
|
|
'user_id',
|
|
'contact_name',
|
|
'contact_email',
|
|
'contact_phone',
|
|
'contact_bank_owner',
|
|
'contact_bank_iban',
|
|
'amount',
|
|
'donation',
|
|
'distance',
|
|
'comment',
|
|
'changes',
|
|
'travel_direction',
|
|
'passengers',
|
|
'transportation',
|
|
'document_filename',
|
|
'approved_by',
|
|
'approved_at',
|
|
'upload_required',
|
|
'denied_by',
|
|
'denied_at',
|
|
'denied_reason',
|
|
];
|
|
|
|
public function costUnit() : BelongsTo{
|
|
return $this->belongsTo(CostUnit::class);
|
|
}
|
|
|
|
public function status() : BelongsTo {
|
|
return $this->belongsTo(InvoiceStatus::class, 'status')->first();
|
|
}
|
|
|
|
public function invoiceType() : InvoiceType {
|
|
return $this->belongsTo(InvoiceType::class, 'type', 'slug')->first();
|
|
}
|
|
}
|