show all permissions for all tenants

i create a models Permissions and roles and need show all permissions for all tenants, how ever i use:
->authMiddleware([
Authenticate::class,
])
->tenant(Company::class, slugAttribute: 'slug', ownershipRelationship: 'owner');
->authMiddleware([
Authenticate::class,
])
->tenant(Company::class, slugAttribute: 'slug', ownershipRelationship: 'owner');
In my companyPanel i use
ownershipRelationship: 'owner'
ownershipRelationship: 'owner'
and need the ownershipRelationship for my saas, but is not necesary in this 2 models (Permission and Role), this is part of my code in Permission Model. Now how can do for get all my permission here, is possible show it without the relation owner?
class Permission extends Model
{
use HasFactory;

protected $fillable = [
'name',
];

public function users(): BelongsToMany
{
return $this->belongsToMany(User::class);
}

public function owner(): HasMany
{
//return $this->hasMany(Permission::class, 'id');
return $this->hasMany(Permission::class, 'id')->where('id', '<>', 0);
}
}
class Permission extends Model
{
use HasFactory;

protected $fillable = [
'name',
];

public function users(): BelongsToMany
{
return $this->belongsToMany(User::class);
}

public function owner(): HasMany
{
//return $this->hasMany(Permission::class, 'id');
return $this->hasMany(Permission::class, 'id')->where('id', '<>', 0);
}
}
i try whit this code
return $this->hasMany(Permission::class, 'id')->where('id', '<>', 0);
return $this->hasMany(Permission::class, 'id')->where('id', '<>', 0);
But is not working, how can fix this problem? thank you guys!
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server