• File: ArticleGroup.php
  • Full Path: /var/www/html/back/app/Models/ArticleGroup.php
  • File size: 926 bytes
  • MIME-type: text/x-php
  • Charset: utf-8
<?php

declare(strict_types=1);

namespace App\Models;

use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Carbon;

/**
 * @property int $id
 * @property int $model_id
 * @property string $name
 * @property string $article_type
 * @property Carbon|null $created_at
 * @property Carbon|null $updated_at
 * @property-read Collection|Article[] $articles
 * @property-read int|null $articles_count
 */
class ArticleGroup extends Model
{
    protected $fillable = ['name',
        'model_id',
        'article_type',
        'sort'];

    public function articles(): HasMany
    {
        return $this->hasMany(Article::class, 'article_group_id');
    }

    public static function example(): array
    {
        return [
            'id' => 1,
            'model_id' => 1,
            'name' => 'Test'
        ];
    }
}