65 lines
1.3 KiB
PHP
65 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Traits\HasAmount;
|
|
use App\Models\Traits\HasProjectionStatus;
|
|
use App\Models\Traits\HasUuid;
|
|
use Carbon\Carbon;
|
|
use Database\Factories\OutflowFactory;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property string $uuid
|
|
* @property int $stream_id
|
|
* @property Stream $stream
|
|
* @property int $amount
|
|
* @property Carbon $date
|
|
* @property string $description
|
|
* @property bool $is_projected
|
|
*
|
|
* @method static create(array $array)
|
|
*/
|
|
class Outflow extends Model
|
|
{
|
|
use HasAmount;
|
|
|
|
/** @use HasFactory<OutflowFactory> */
|
|
use HasFactory;
|
|
|
|
use HasProjectionStatus;
|
|
use HasUuid;
|
|
|
|
protected $fillable = [
|
|
'stream_id',
|
|
'bucket_id',
|
|
'amount',
|
|
'date',
|
|
'description',
|
|
'is_projected',
|
|
];
|
|
|
|
protected $casts = [
|
|
'amount' => 'integer',
|
|
'date' => 'date',
|
|
'is_projected' => 'boolean',
|
|
];
|
|
|
|
public function stream(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Stream::class);
|
|
}
|
|
|
|
public function bucket(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Bucket::class);
|
|
}
|
|
|
|
public function scenario(): BelongsTo
|
|
{
|
|
return $this->stream->scenario();
|
|
}
|
|
}
|