Files
animethemes-server/app/Contracts/Http/Api/Field/RenderableField.php
T
paranarimasu 27778857b1 Request action composition (#516)
* refactor(api): prefer composition to strict inheritance for API queries, requests & actions

* style: fix StyleCI findigns
2023-02-16 23:30:57 -06:00

31 lines
570 B
PHP

<?php
declare(strict_types=1);
namespace App\Contracts\Http\Api\Field;
use App\Http\Api\Query\Query;
use Illuminate\Database\Eloquent\Model;
/**
* Interface RenderableField.
*/
interface RenderableField
{
/**
* Determine if the field should be displayed to the user.
*
* @param Query $query
* @return bool
*/
public function shouldRender(Query $query): bool;
/**
* Get the value to display to the user.
*
* @param Model $model
* @return mixed
*/
public function render(Model $model): mixed;
}