File "Account.php"

Full Path: /var/www/html/back/app/Repositories/Account.php
File size: 1.25 KB
MIME-type: text/x-php
Charset: utf-8

<?php

declare(strict_types=1);

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Carbon;

/**
 * @property int $id
 * @property int $model_id
 * @property string $name
 * @property int $organization_id
 * @property float $deposit
 * @property Carbon|null $created_at
 * @property Carbon|null $updated_at
 *
 * @property-read Organization $organization
 */
class Account extends Model
{
    protected $table = 'accounts';

    protected $fillable = [
        'model_id',
        'external_id',
        'name',
        'organization_id',
        'deposit',
        'number',
        'archived',
        'added',
        'cor_number',
        'balance_of_the_date',
        'bank_name',
        'bank_bic',
        'bank_city',
        'organization_name',
        'is_cash',
        'current_balance'
    ];

    /**
     * Связь с моделью Organization.
     */

    public function organization(): BelongsTo
    {
        return $this->belongsTo(Organization::class, 'organization_id');
    }

    public function payments()
    {
        return $this->HasMany(Payment::class);
    }

    public function bank()
    {
        return $this->belongsTo(Bank::class);
    }
}