PHP Trait HipsterJazzbo\Landlord\BelongsToTenants

Show file Open project: HipsterJazzbo/Landlord

Protected Properties

Property Type Description
$landlord TenantManager

Public Methods

Method Description
allTenants ( ) : Builder Returns a new query builder without any of the tenant scopes applied.
bootBelongsToTenants ( ) Boot the trait. Will apply any scopes currently set, and register a listener for when new models are created.
findOrFail ( mixed $id, array $columns = ['*'] ) : Illuminate\Database\Eloquent\Collection | Model Override the default findOrFail method so that we can re-throw a more useful exception. Otherwise it can be very confusing why queries don't work because of tenant scoping issues.
getTenantColumns ( ) : array Get the tenantColumns for this model.

Method Details

allTenants() public static method

$allUsers = User::allTenants()->get();
public static allTenants ( ) : Builder
return Illuminate\Database\Eloquent\Builder

bootBelongsToTenants() public static method

Boot the trait. Will apply any scopes currently set, and register a listener for when new models are created.
public static bootBelongsToTenants ( )

findOrFail() public static method

Override the default findOrFail method so that we can re-throw a more useful exception. Otherwise it can be very confusing why queries don't work because of tenant scoping issues.
public static findOrFail ( mixed $id, array $columns = ['*'] ) : Illuminate\Database\Eloquent\Collection | Model
$id mixed
$columns array
return Illuminate\Database\Eloquent\Collection | Illuminate\Database\Eloquent\Model

getTenantColumns() public method

Get the tenantColumns for this model.
public getTenantColumns ( ) : array
return array

Property Details

$landlord protected static property

protected static TenantManager,HipsterJazzbo\Landlord $landlord
return TenantManager