Skip to content

Commit

Permalink
Merge pull request #3 from savannabits/development
Browse files Browse the repository at this point in the history
Fix: Framework getByCode now accepts an array input
  • Loading branch information
coolsam726 authored Oct 19, 2023
2 parents 71f45b5 + cf6a725 commit 9dfaac4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Helpers/Framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ public function getByCode(Model | string $model, string $code)
if (! Schema::hasColumn($model::query()->getModel()->getTable(), 'code')) {
return null;
}

if (is_array($code)) {
return $model::query()->whereIn('code', $code)->get();
}
return $model::query()->where('code', '=', trim($code))->first();
}

Expand Down

0 comments on commit 9dfaac4

Please sign in to comment.