Skip to content

Commit

Permalink
Fixed Eloquent Exception usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Radiergummi committed Feb 11, 2021
1 parent e0a0351 commit 11a1191
Showing 1 changed file with 6 additions and 25 deletions.
31 changes: 6 additions & 25 deletions src/Exceptions/DocumentNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

namespace Matchory\Elasticsearch\Exceptions;

use Illuminate\Database\RecordsNotFoundException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Arr;
use Matchory\Elasticsearch\Model;

use function count;
use function implode;

class DocumentNotFoundException extends RecordsNotFoundException
class DocumentNotFoundException extends ModelNotFoundException
{
/**
* Name of the affected Elasticsearch model.
Expand All @@ -26,25 +27,15 @@ class DocumentNotFoundException extends RecordsNotFoundException
*/
protected $ids;

/**
* Get the affected Eloquent model.
*
* @return string
*/
public function getModel(): string
{
return $this->model;
}

/**
* Set the affected Eloquent model and instance ids.
*
* @param string $model
* @param string|array $ids
* @param class-string<Model> $model
* @param string|array $ids
*
* @return $this
*/
public function setModel(string $model, $ids = []): self
public function setModel($model, $ids = []): self
{
$this->model = $model;
$this->ids = Arr::wrap($ids);
Expand All @@ -57,14 +48,4 @@ public function setModel(string $model, $ids = []): self

return $this;
}

/**
* Get the affected Eloquent model IDs.
*
* @return string|array
*/
public function getIds()
{
return $this->ids;
}
}

0 comments on commit 11a1191

Please sign in to comment.