1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 10:54:04 +00:00

findBy\* ForwardsCalls

This commit is contained in:
Samuel Štancl 2019-10-24 18:59:21 +02:00
parent 696863b1d4
commit a80275c1ac

View file

@ -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);
}
}