<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;

/**
 * Class Author
 *
 * @property int $id
 * @property string $name
 * @property string $avatar
 * @property string $bio
 * @property bool $enabled
 * @property bool $public
 * @property Carbon|null $created_at
 * @property Carbon|null $updated_at
 * @property Collection|Post[] $posts
 */
class Author extends Model
{
    protected $table = 'authors';

    protected $casts = [
        'enabled' => 'bool',
        'public' => 'bool',
    ];

    protected $fillable = [
        'name',
        'avatar',
        'bio',
        'enabled',
        'public',
    ];

    public function posts()
    {
        return $this->hasMany(Post::class);
    }
}
