mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 11:14:04 +00:00
[4.x] Fix 1267: early return in runForMultiple if an empty array is passed (#1286)
* fix 1267: early return in runForMultiple if an empty array is passed * Test that runForMulltiple runs the passed closure for the right tenants * Correct comment --------- Co-authored-by: lukinovec <lukinovec@gmail.com>
This commit is contained in:
parent
25360f6b6a
commit
30ee4e9529
2 changed files with 77 additions and 2 deletions
|
|
@ -204,8 +204,10 @@ class Tenancy
|
|||
// Wrap string in array
|
||||
$tenants = is_string($tenants) ? [$tenants] : $tenants;
|
||||
|
||||
// Use all tenants if $tenants is falsy
|
||||
$tenants = $tenants ?: $this->model()->cursor(); // todo@phpstan phpstan thinks this isn't needed, but tests fail without it
|
||||
// If $tenants is falsy by this point (e.g. an empty array) there's no work to be done
|
||||
if (! $tenants) {
|
||||
return;
|
||||
}
|
||||
|
||||
$originalTenant = $this->tenant;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue