File manager - Edit - /var/www/html/gop/api/app/Models/Material.php
Back
<?php namespace App\Models; use App\Casts\Money; use Illuminate\Database\Eloquent\Casts\Attribute; class Material extends BaseModel { protected $table = 'materiais'; protected $fillable = [ 'titulo', 'descricao', 'valor_unitario', 'quantidade', 'marca', 'fornecimento_id', ]; protected $casts = [ 'valor_unitario' => Money::class, ]; protected $appends = [ 'valor_total', ]; protected function valorTotal(): Attribute { $valor = number_format($this->valor_unitario * $this->quantidade, 2, '.', ''); return new Attribute( get: fn () => $valor, ); } public function fornecimento() { return $this->belongsTo(Fornecimento::class); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings