mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 04:34:02 +00:00
Remove withPending from runForMultiple
This commit is contained in:
parent
c44a4c56d5
commit
fd809bc81a
2 changed files with 3 additions and 33 deletions
|
|
@ -9,7 +9,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
use Illuminate\Support\Traits\Macroable;
|
||||
use Stancl\Tenancy\Contracts\TenancyBootstrapper;
|
||||
use Stancl\Tenancy\Contracts\Tenant;
|
||||
use Stancl\Tenancy\Database\Concerns\PendingScope;
|
||||
use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedById;
|
||||
|
||||
class Tenancy
|
||||
|
|
@ -131,15 +130,10 @@ class Tenancy
|
|||
* @param Tenant[]|\Traversable|string[]|null $tenants
|
||||
* @return void
|
||||
*/
|
||||
public function runForMultiple($tenants, callable $callback, bool $withPending = null)
|
||||
public function runForMultiple($tenants, callable $callback)
|
||||
{
|
||||
$query = $this->model()->newQuery();
|
||||
|
||||
if (is_bool($withPending) && $this->model()::hasGlobalScope(PendingScope::class)) {
|
||||
$query->withPending($withPending);
|
||||
}
|
||||
// Convert null to all tenants
|
||||
$tenants = is_null($tenants) ? $query->cursor() : $tenants;
|
||||
$tenants = is_null($tenants) ? $this->model()->cursor() : $tenants;
|
||||
|
||||
// Convert incrementing int ids to strings
|
||||
$tenants = is_int($tenants) ? (string) $tenants : $tenants;
|
||||
|
|
@ -148,7 +142,7 @@ class Tenancy
|
|||
$tenants = is_string($tenants) ? [$tenants] : $tenants;
|
||||
|
||||
// Use all tenants if $tenants is falsy
|
||||
$tenants = $tenants ?: $query->cursor();
|
||||
$tenants = $tenants ?: $this->model()->cursor();
|
||||
|
||||
$originalTenant = $this->tenant;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue