mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 10:54:04 +00:00
findBy\* ForwardsCalls
This commit is contained in:
parent
696863b1d4
commit
a80275c1ac
1 changed files with 12 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ namespace Stancl\Tenancy;
|
|||
use Illuminate\Contracts\Console\Kernel as ConsoleKernel;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Traits\ForwardsCalls;
|
||||
use Stancl\Tenancy\Contracts\TenantCannotBeCreatedException;
|
||||
use Stancl\Tenancy\Exceptions\NotImplementedException;
|
||||
use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedException;
|
||||
|
|
@ -18,6 +19,8 @@ use Stancl\Tenancy\Jobs\QueuedTenantDatabaseSeeder;
|
|||
*/
|
||||
class TenantManager
|
||||
{
|
||||
use ForwardsCalls;
|
||||
|
||||
/**
|
||||
* The current tenant.
|
||||
*
|
||||
|
|
@ -426,4 +429,13 @@ class TenantManager
|
|||
return $prevented;
|
||||
}, []);
|
||||
}
|
||||
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
if (Str::startsWith($method, 'findBy')) {
|
||||
return $this->findBy(Str::snake(substr($method, 6)), $parameters[0]);
|
||||
}
|
||||
|
||||
static::throwBadMethodCallException($method);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue