38 lines
729 B
PHP
38 lines
729 B
PHP
<?php namespace App\Models;
|
|
/**
|
|
* @copyright (c) 2025 Notsoweb Software (https://notsoweb.com) - All Rights Reserved
|
|
*/
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Bill extends Model
|
|
{
|
|
protected $fillable = [
|
|
'name',
|
|
'supplier_id',
|
|
'cost',
|
|
'file_path',
|
|
'deadline',
|
|
'paid',
|
|
];
|
|
|
|
protected $casts = [
|
|
'cost' => 'decimal:2',
|
|
'paid' => 'boolean',
|
|
];
|
|
|
|
protected $appends = ['file_url'];
|
|
|
|
public function supplier()
|
|
{
|
|
return $this->belongsTo(Supplier::class);
|
|
}
|
|
|
|
public function getFileUrlAttribute(): ?string
|
|
{
|
|
if (!$this->file_path) return null;
|
|
return asset('storage/' . $this->file_path);
|
|
}
|
|
}
|