38 lines
724 B
PHP
38 lines
724 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Support\Str;
|
|
|
|
class PredefinedMutation extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'ledger_id',
|
|
'name',
|
|
'description',
|
|
'amount',
|
|
];
|
|
|
|
public function ledger(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Ledger::class);
|
|
}
|
|
|
|
protected static function booted(): void
|
|
{
|
|
static::creating(function ($model) {
|
|
$model->uuid = (string) Str::uuid();
|
|
});
|
|
}
|
|
|
|
public function getRouteKeyName()
|
|
{
|
|
return 'uuid';
|
|
}
|
|
}
|