Skip to content

Commit

Permalink
Merge pull request #110 from telkins/patch-2
Browse files Browse the repository at this point in the history
TenantAware should use the tenant model...
  • Loading branch information
masterix21 authored Aug 7, 2020
2 parents aa1252b + 8dd1f18 commit f29e958
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Commands/Concerns/TenantAware.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@

use Illuminate\Support\Arr;
use Spatie\Multitenancy\Concerns\UsesMultitenancyConfig;
use Spatie\Multitenancy\Models\Tenant;
use Spatie\Multitenancy\Models\Concerns\UsesTenantModel;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

trait TenantAware
{
use UsesMultitenancyConfig;
use UsesMultitenancyConfig,
UsesTenantModel;

protected function execute(InputInterface $input, OutputInterface $output)
{
$tenants = Arr::wrap($this->option('tenant'));

$tenantQuery = Tenant::query()
$tenantQuery = $this->getTenantModel()::query()
->when(! blank($tenants), function ($query) use ($tenants) {
collect($this->getTenantArtisanSearchFields())
->each(fn ($field) => $query->orWhereIn($field, Arr::wrap($tenants)));
Expand Down

0 comments on commit f29e958

Please sign in to comment.