PLEASE - SEE THE RELEASES PAGE - https://github.com/nunomazer/laravel-samehouse/releases, since it have all the tracking of changes each version has for this package.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- No longer allow
NULL
as a tenant id
- Support Laravel 5.4
- Added
getQualifiedTenant()
method toBelongsToTenants
trait. Override this if you need to change or remove the qualification for a particular model, for example if you are using a NoSQL database.
- Fixed Lumen compatibility by checking for presence of
config_path()
before trying to register publishable assets.
- Added
getTenantId()
method
- Fixed an issue with
newQueryWithoutTenants
-
Landlord now supports Lumen (5.2+) out of the box.
-
Landlord now uses Laravel's anonymous global scopes, so you can disable scoping for one or more individual tenants for a single query using
Model::withoutGlobalScope('tenant_column')
, orModel::withoutGlobalScopes(['tenant_column_a', 'tenant_column_b'])
.Note:
Model::allTenants()
still returns a query with none of the tenant scopes applied. -
You can now pass a Model instance to
addTenant()
. Landlord will use Eloquent'sgetForeignKey()
method as the tenant column name.
-
Renamed
LandlordFacade
→Landlord
. -
Renamed
BelongsToTenant
→BelongsToTenants
(plural).Note: You will have to update your use statements in scoped models.
-
Renamed
TenantModelNotFoundException
→ModelNotFoundForTenantException
. Make sure to update anycatch
statements. -
Renamed
Landlord
→TenantManager
.Note: You will have to update any places you're injecting an instance:
//Before
public function __construct(\HipsterJazzbo\Landlord\Landlord $landlord) {
$this->landlord = $landlord;
}
// After
public function __construct(\HipsterJazzbo\Landlord\TenantManager $landlord) {
$this->landlord = $landlord;
}
-
TenantManager
now uses an\Illuminate\Support\Collection
instance to manage tenants internally. This has cleaned up the code a lot.Note
getTenants()
now returns theCollection
instance instead of an array. If you need a plain array of tenants, you may callLandlord::getTenants()->all()
. -
The service provider no longer registers the
Landlord
facade for you. You'll need to do it in yourconfig/app.php
if you weren't already. -
Landlord now actually checks for non-tenanted existence before throwing a
ModelNotFoundForTenantException
.