@@ -18,9 +18,9 @@ the package's error class. All the keys described in the specification's
1818For example:
1919
2020``` php
21- use CloudCreativity\LaravelJsonApi\Document\Error;
21+ use CloudCreativity\LaravelJsonApi\Document\Error\Error ;
2222
23- $error = Error::create ([
23+ $error = Error::fromArray ([
2424 'id' => '91053382-7c00-45eb-bdcc-8359d03debbb',
2525 'status' => '500',
2626 'code' => 'unexpected',
@@ -40,15 +40,16 @@ The `JsonApiController` has a responses factory that can create error responses.
4040to return an error response in a controller hook, as demonstrated in the following example:
4141
4242``` php
43- use CloudCreativity\LaravelJsonApi\Document\Error;
43+ use CloudCreativity\LaravelJsonApi\Document\Error\Error;
44+ use CloudCreativity\LaravelJsonApi\Http\Controllers\JsonApiController;
4445
4546class PaymentController extends JsonApiController
4647{
4748
4849 protected function creating()
4950 {
5051 if (/** some condition */) {
51- return $this->reply()->errors(Error::create ([
52+ return $this->reply()->errors(Error::fromArray ([
5253 'title' => 'Payment Required',
5354 'detail' => 'Your card has expired.',
5455 'status' => '402',
@@ -85,12 +86,12 @@ to a JSON API response. For example:
8586
8687``` php
8788use Neomerx\JsonApi\Exceptions\JsonApiException;
88- use CloudCreativity\LaravelJsonApi\Document\Error;
89+ use CloudCreativity\LaravelJsonApi\Document\Error\Error ;
8990
9091try {
9192 dispatchNow(new ChargeCard($token));
9293} catch (\App\PaymentException $ex) {
93- $error = Error::create ([
94+ $error = Error::fromArray ([
9495 'title' => 'Payment Required',
9596 'detail' => $ex->getMessage(),
9697 'status' => '402',
0 commit comments