Allow meta to be added with plain values

This commit is contained in:
Toby Zerner 2021-01-07 11:18:39 +10:00
parent 8a473e791a
commit b9f6858a19
1 changed files with 3 additions and 2 deletions

View File

@ -12,6 +12,7 @@
namespace Tobyz\JsonApiServer\Schema\Concerns;
use Tobyz\JsonApiServer\Schema\Meta;
use function Tobyz\JsonApiServer\wrap;
trait HasMeta
{
@ -20,9 +21,9 @@ trait HasMeta
/**
* Add a meta attribute.
*/
public function meta(string $name, callable $value): Meta
public function meta(string $name, $value): Meta
{
return $this->meta[$name] = new Meta($name, $value);
return $this->meta[$name] = new Meta($name, wrap($value));
}
/**