<?php

namespace PluginsNameSpaces\Models;

use PluginsNameSpaces\Framework\Database\Orm\Model;

/**
 * A child item belonging to an Example (demonstrates belongsTo).
 */
class ExampleItem extends Model
{
    /** @var string Table name (without the WordPress prefix). */
    protected static $table = '__SNAKE_NAME___example_items';

    /** @var array Mass-assignable attributes. */
    protected $fillable = ['example_id', 'label'];

    /** @var array Attribute casts. */
    protected $casts = [
        'id'         => 'int',
        'example_id' => 'int',
    ];

    /**
     * The parent example.
     *
     * @return \PluginsNameSpaces\Framework\Database\Orm\Relations\BelongsTo
     */
    public function example()
    {
        return $this->belongsTo(Example::class, 'example_id');
    }
}
