Filament Multi-Tenancy
I'm out of ideas for testing with Filament Tenancy, which sometimes gives me a 403 error for the Filament resource. Some resources are working.
->beforeEach(function () {
$this->setupAdmin();
$this->tenant = Tenant::factory()->create();
$this->admin->tenants()->attach($this->tenant);
actingAs($this->admin);
Filament::setTenant($this->tenant); ->beforeEach(function () {
$this->setupAdmin();
$this->tenant = Tenant::factory()->create();
$this->admin->tenants()->attach($this->tenant);
actingAs($this->admin);
Filament::setTenant($this->tenant); public function setupAdmin()
{
$this->seed();
$this->admin = User::where('email', 'admin@admin.com')->first();
$role = Role::firstOrCreate(['name' => 'admin']);
$permission = Permission::all();
$this->admin->assignRole($role);
$this->admin->givePermissionTo($permission);
} public function setupAdmin()
{
$this->seed();
$this->admin = User::where('email', 'admin@admin.com')->first();
$role = Role::firstOrCreate(['name' => 'admin']);
$permission = Permission::all();
$this->admin->assignRole($role);
$this->admin->givePermissionTo($permission);
}<?php
use App\Filament\Resources\TechnicianResource;
use function Pest\Laravel\get;
it('can render page', function () {
get(TechnicianResource::getUrl('index'))
->assertSuccessful();
})
->group('technician');<?php
use App\Filament\Resources\TechnicianResource;
use function Pest\Laravel\get;
it('can render page', function () {
get(TechnicianResource::getUrl('index'))
->assertSuccessful();
})
->group('technician');class TechnicianResource extends Resource
{
protected static ?string $model = Technician::class;
protected static ?string $tenantOwnershipRelationshipName = 'tenant';class TechnicianResource extends Resource
{
protected static ?string $model = Technician::class;
protected static ?string $tenantOwnershipRelationshipName = 'tenant';