<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Carbon;
/**
* @property int $id
* @property int $payment_id
* @property float $amount
* @property ?float $comission
* @property ?float $cashbox
* @property int $project_id
* @property int $article_id
* @property Carbon $created_at
* @property Carbon $updated_at
* @property Payment $payment
* @property Project $project
* @property Article $article
*/
class PaymentDistribution extends Model
{
use HasFactory;
protected $fillable = ['payment_id', 'amount', 'project_id', 'article_id', 'amount_limit', 'comission', 'cashbox'];
protected $casts = [
'amount' => 'decimal:2',
];
public function payment(): BelongsTo
{
return $this->belongsTo(Payment::class);
}
public function project(): BelongsTo
{
return $this->belongsTo(Project::class);
}
public function article(): BelongsTo
{
return $this->belongsTo(Article::class);
}
}