• File: Organization.php
  • Full Path: /var/www/html/back/app/Models/Organization.php
  • File size: 860 bytes
  • 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\HasMany;

/**
 * @property int $id
 * @property int $model_id
 * @property string $full_name
 * @property string $short_name
 * @property string $inn
 * @property string $kpp
 * @property ?string $external_id
 * @property ?string $api_key
 * @property bool $archived
 *
 * @property-read Account[] $account
 */
class Organization extends Model
{
    protected $fillable = [
        'model_id',
        'full_name',
        'short_name',
        'inn',
        'kpp',
        'external_id',
        'api_key',
        'archived',
    ];


    protected $casts = [
        'archived' => 'bool',
    ];

    public function accounts(): HasMany
    {
        return $this->hasMany(Account::class, 'organization_id');
    }
}