CRM/backend/app/Models/InvoiceTemplate.php

39 خطوط
1.0 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class InvoiceTemplate extends Model
{
protected $fillable = [
'name', 'background_path', 'background_name', 'background_mime', 'layout',
'source_path', 'source_name', 'source_mime', 'base_type', 'background_settings',
'page_width_mm', 'page_height_mm', 'is_default', 'is_active', 'created_by',
];
protected function casts(): array
{
return [
'layout' => 'array',
'background_settings' => 'array',
'is_default' => 'boolean',
'is_active' => 'boolean',
'page_width_mm' => 'integer',
'page_height_mm' => 'integer',
];
}
public function creator(): BelongsTo
{
return $this->belongsTo(User::class, 'created_by');
}
public function invoices(): HasMany
{
return $this->hasMany(Invoice::class);
}
}