HipsterJazzbo\Landlord\TenantManager::newQueryWithoutTenants PHP 메소드

newQueryWithoutTenants() 공개 메소드

Get a new Eloquent Builder instance without any of the tenant scopes applied.
public newQueryWithoutTenants ( Model $model ) : Builder
$model Illuminate\Database\Eloquent\Model
리턴 Illuminate\Database\Eloquent\Builder
    public function newQueryWithoutTenants(Model $model)
    {
        return $model->newQuery()->withoutGlobalScopes($this->tenants->keys()->toArray());
    }

Usage Example

예제 #1
0
 /**
  * Returns a new query builder without any of the tenant scopes applied.
  *
  *     $allUsers = User::allTenants()->get();
  *
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public static function allTenants()
 {
     return static::$landlord->newQueryWithoutTenants(new static());
 }