Skip to content

Commit

Permalink
Merge pull request #5 from andreiio/fix/trait-detection
Browse files Browse the repository at this point in the history
Detect SearchableTrait in parent classes and traits of their traits.
  • Loading branch information
veneliniliev authored Apr 20, 2021
2 parents 5df0678 + 683a8db commit fd9a489
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Commands/IndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function handle(): void
{
$modelClass = $this->argument('model_class');

if (!in_array(SearchableTrait::class, class_uses($modelClass), true)) {
if (!in_array(SearchableTrait::class, class_uses_recursive($modelClass), true)) {
$this->error('Model not using ' . SearchableTrait::class);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/UnIndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function handle(): void
/** @var string $modelClass */
$modelClass = $this->argument('model_class');

if (!in_array(SearchableTrait::class, class_uses($modelClass), true)) {
if (!in_array(SearchableTrait::class, class_uses_recursive($modelClass), true)) {
$this->error('Model not using ' . SearchableTrait::class);
return;
}
Expand Down

0 comments on commit fd9a489

Please sign in to comment.