mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 14:14:04 +00:00
fix phpstan errors
This commit is contained in:
parent
18a16e6a74
commit
4372e1bef2
20 changed files with 105 additions and 16 deletions
|
|
@ -20,6 +20,8 @@ class PendingScope implements Scope
|
|||
/**
|
||||
* Apply the scope to a given Eloquent query builder.
|
||||
*
|
||||
* @param Builder<\Stancl\Tenancy\Contracts\Tenant&Model> $builder
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function apply(Builder $builder, Model $model)
|
||||
|
|
@ -32,6 +34,8 @@ class PendingScope implements Scope
|
|||
/**
|
||||
* Extend the query builder with the needed functions.
|
||||
*
|
||||
* @param Builder<\Stancl\Tenancy\Contracts\Tenant&Model> $builder
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function extend(Builder $builder)
|
||||
|
|
@ -43,6 +47,8 @@ class PendingScope implements Scope
|
|||
/**
|
||||
* Add the with-pending extension to the builder.
|
||||
*
|
||||
* @param Builder<\Stancl\Tenancy\Contracts\Tenant&Model> $builder
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function addWithPending(Builder $builder)
|
||||
|
|
@ -59,6 +65,8 @@ class PendingScope implements Scope
|
|||
/**
|
||||
* Add the without-pending extension to the builder.
|
||||
*
|
||||
* @param Builder<\Stancl\Tenancy\Contracts\Tenant&Model> $builder
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function addWithoutPending(Builder $builder)
|
||||
|
|
@ -75,6 +83,8 @@ class PendingScope implements Scope
|
|||
/**
|
||||
* Add the only-pending extension to the builder.
|
||||
*
|
||||
* @param Builder<\Stancl\Tenancy\Contracts\Tenant&Model> $builder
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function addOnlyPending(Builder $builder)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ use Illuminate\Database\Eloquent\Scope;
|
|||
|
||||
class ParentModelScope implements Scope
|
||||
{
|
||||
/**
|
||||
* @param Builder<Model> $builder
|
||||
*/
|
||||
public function apply(Builder $builder, Model $model): void
|
||||
{
|
||||
if (! tenancy()->initialized) {
|
||||
|
|
@ -19,6 +22,9 @@ class ParentModelScope implements Scope
|
|||
$builder->whereHas($builder->getModel()->getRelationshipToPrimaryModel());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder<Model> $builder
|
||||
*/
|
||||
public function extend(Builder $builder): void
|
||||
{
|
||||
$builder->macro('withoutParentModel', function (Builder $builder) {
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ use Stancl\Tenancy\Contracts\Tenant;
|
|||
* @method Tenant[] toArray()
|
||||
* @method Tenant offsetGet($key)
|
||||
* @method Tenant first()
|
||||
*
|
||||
* @extends Collection<int|string, Tenant&\Illuminate\Database\Eloquent\Model>
|
||||
*/
|
||||
class TenantCollection extends Collection
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ use Stancl\Tenancy\Tenancy;
|
|||
|
||||
class TenantScope implements Scope
|
||||
{
|
||||
/**
|
||||
* @param Builder<Model> $builder
|
||||
*/
|
||||
public function apply(Builder $builder, Model $model)
|
||||
{
|
||||
if (! tenancy()->initialized) {
|
||||
|
|
@ -20,6 +23,9 @@ class TenantScope implements Scope
|
|||
$builder->where($model->qualifyColumn(Tenancy::tenantKeyColumn()), tenant()->getTenantKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Builder<Model> $builder
|
||||
*/
|
||||
public function extend(Builder $builder): void
|
||||
{
|
||||
$builder->macro('withoutTenancy', function (Builder $builder) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue