<?php

namespace Aura\Base\Fields;

class HasOneOfMany extends Field
{
    public $edit = 'aura::fields.has-one-of-many';

    public bool $group = false;

    public $optionGroup = 'Relationship Fields';

    public string $type = 'relation';

    public function resource($model, $resource, $option)
    {
        // return $model->posts()->latest()->first();

        return app($resource)->where('user_id', $model->id)->latest()->first();
    }
}
