d2d.emegrendeles.hu/app/Traits/JsonApiCustomFunctionTraits.php
E98Developer 68b7c35bef git init
2026-02-28 06:53:05 +01:00

29 lines
717 B
PHP

<?php
namespace App\Traits;
use LaravelJsonApi\Core\Document\Error;
use LaravelJsonApi\Core\Document\ErrorList;
trait JsonApiCustomFunctionTraits
{
private function convertMessageBagToJSONAPIError($messageBag)
{
$errorList = ErrorList::fromArray([]);
foreach ($messageBag->toArray() as $key => $messageArray) {
$error = Error::fromArray([
/*
'status'=>201,
'id'=>99,
*/
'detail' => "'".$messageArray[0]."'",
'source' => ['pointer' => "'".$key."'"],
]);
$errorList->push($error);
}
return $errorList;
}
}