File manager - Edit - /var/www/html/gop/api/app/Models/NotaFiscal.php
Back
<?php namespace App\Models; use App\Casts\Money; use Illuminate\Database\Eloquent\Casts\Attribute; class NotaFiscal extends BaseModel { protected $table = 'notas_fiscais'; protected $fillable = [ 'numero', 'data', 'valor', 'obra_id', 'descricao', ]; protected $casts = [ 'valor' => Money::class, ]; protected $appends = [ 'anexos', ]; protected function anexos(): Attribute { $arquivos = $this->arquivos; $images = $this->images; $anexos = [ 'arquivos' => $arquivos, 'images' => $images, ]; return new Attribute( get: fn () => $anexos, ); } public function images() { return $this->morphMany(Image::class, 'imageable'); } public function arquivos() { return $this->morphMany(Arquivo::class, 'arquivable'); } public function empenhos() { return $this->belongsToMany(Empenho::class, 'empenho_nota_fiscal') ->withPivot('valor_empenhado'); } public function obra() { return $this->belongsTo(Obra::class); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings