F
Filament17mo ago
Tieme

EditTenantProfile in Navigation

Hi All, I have Multi-tenancy and i can change my tenant information from the tenant menu
php
->tenantProfile(EditCompanyProfile::class)
php
->tenantProfile(EditCompanyProfile::class)
Now i want to change the location of this menu item to the Sidebar Navigation (below my Dashboard page) When i add
protected static bool $isDiscovered = true;
protected static bool $isDiscovered = true;
I get following error
Route [filament.company.tenant.profile] not defined.
Route [filament.company.tenant.profile] not defined.
I also get this error is i add it in panel like
->navigationItems([
NavigationItem::make()
->label('Test')
->url(EditCompanyProfile::getUrl([
'tenant' => Filament::getTenant()
]))
])
->navigationItems([
NavigationItem::make()
->label('Test')
->url(EditCompanyProfile::getUrl([
'tenant' => Filament::getTenant()
]))
])
Is it possible to change the location of the Tenant edit profile. Below is my complete page code for
EditCompanyProfile.php
EditCompanyProfile.php
<?php

namespace App\Filament\Company\Pages;

use Filament\Forms;
use Filament\Forms\Form;
use Filament\Pages\Tenancy\EditTenantProfile;

class EditCompanyProfile extends EditTenantProfile
{
protected static bool $isDiscovered = true;
public static function getLabel(): string
{
return 'Company profile';
}

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Section::make(__('filament/tenacy/company.contact_details'))
->columns(2)
->schema([
Forms\Components\TextInput::make('company_name')
->label(__('filament/tenacy/company.company_name'))
->required()
->maxLength(255),
]),
]);
}
}
<?php

namespace App\Filament\Company\Pages;

use Filament\Forms;
use Filament\Forms\Form;
use Filament\Pages\Tenancy\EditTenantProfile;

class EditCompanyProfile extends EditTenantProfile
{
protected static bool $isDiscovered = true;
public static function getLabel(): string
{
return 'Company profile';
}

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Section::make(__('filament/tenacy/company.contact_details'))
->columns(2)
->schema([
Forms\Components\TextInput::make('company_name')
->label(__('filament/tenacy/company.company_name'))
->required()
->maxLength(255),
]),
]);
}
}
Thanks for the help
2 Replies
Tieme
TiemeOP2mo ago
up up up
LarrySD
LarrySD4w ago
For the URL, I fixed it with this:
->tenantMenuItems([
MenuItem::make()
->label('Settings')
->url(fn(): string => url(OrganizationSettings::getUrl()))
->icon('heroicon-m-cog-8-tooth'),
])
->tenantMenuItems([
MenuItem::make()
->label('Settings')
->url(fn(): string => url(OrganizationSettings::getUrl()))
->icon('heroicon-m-cog-8-tooth'),
])
note the url () with getUrl() of the class that inherits from EditTenantProfile

Did you find this page helpful?