Skip to content

Commit

Permalink
Merge pull request #21 from mahmoudmohamedramadan/revert-20-development
Browse files Browse the repository at this point in the history
Revert "[1.x] Undo changes"
  • Loading branch information
mahmoudmohamedramadan authored Dec 13, 2024
2 parents 6ac66c3 + 7634343 commit 2e209eb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
24 changes: 0 additions & 24 deletions src/Concerns/Search/HasModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,30 +85,6 @@ protected function getRelationship()
return $this->relationship;
}

/**
* Resolve the model for the current context.
*
* @return void
*
* @throws \Ramadan\EasyModel\Exceptions\InvalidModel
*/
protected function resolveModel()
{
// We will check if the model has been set using the "setSearchableModel" method
// as a manual setting is more of a priority otherwise it means the developer uses
// the "Searchable" trait in the model itself.
if (!empty($this->getSearchableModel())) {
return;
}

if (is_a(self::class, Model::class, true)) {
$this->setSearchableModel(self::class);
return;
}

throw new InvalidModel("Cannot resolve the searchable model.");
}

/**
* Apply the scopes to the query.
*
Expand Down
2 changes: 0 additions & 2 deletions src/Searchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ public function addOrWhereRelation(array $wheres, EloquentBuilder $query = null)
*/
protected function getSearchableEloquentBuilder()
{
$this->resolveModel();

$model = $this->getSearchableModel();
$relationship = $this->getRelationship();

Expand Down

0 comments on commit 2e209eb

Please sign in to comment.