ingmontoya
ingmontoya
FFilament
Created by ingmontoya on 3/9/2024 in #❓┊help
Share records between panels
Hey y'all, It's posible to have a two panels in a multitenancy environment, that can share records between each other? for example user1 in tenanA creates a record, then user2 in tenantB receives that record and it's able to view and edit it? I tried to do it but when user1 in tenanA creates a record, user2 in tenantB can see the record in the table but when tries to open it, it falls into a 404 - that's because user2 in tenantB is not the owner of the record. Any ideas?
5 replies
FFilament
Created by ingmontoya on 2/5/2024 in #❓┊help
Allow editing a non owner record
Hello, I'm in the process of developing an order management system where a buyer places a purchase order with a seller in a different tenant. So far, everything is functioning smoothly (I'm using a single table). However, a challenge arises when the seller in another tenant attempts to access the record, resulting in a 404 error. I've identified that this issue stems from the fact that the seller is not the owner of the record, as I modify the team_id in the database, allowing me to view it without any problems. I'm unsure about how to configure the system to display the field and permit editing, even if the user is not the owner. Do you have any suggestions? I've read about record ownership in the documentation, but I'm uncertain about its practical implementation. It's worth noting that the table includes two foreign keys (team_id and provider_id, the latter being the team ID of the seller).
10 replies
FFilament
Created by ingmontoya on 1/31/2024 in #❓┊help
NavigationGroup
Is there a way to conditionally hide a navigationGroup?
8 replies
FFilament
Created by ingmontoya on 1/18/2024 in #❓┊help
Can I trigger a modal in the main dashboard?
If so, how can be possible?
1 replies
FFilament
Created by ingmontoya on 1/16/2024 in #❓┊help
handleRecordUpdate
Hi, I'm trying to get the relation data within the handleRecordUpdate
protected function handleRecordUpdate(Model $record, array $data): Model
{
dd($record->toArray(), $data);
$record->editOrder($data);
$this->updateProductQty($record);
return $record;
}
protected function handleRecordUpdate(Model $record, array $data): Model
{
dd($record->toArray(), $data);
$record->editOrder($data);
$this->updateProductQty($record);
return $record;
}
It's a resource page, not a modal... but I don't know how do I get the relationship data:
return Repeater::make('items')
->relationship()
->schema([
Forms\Components\Select::make('shop_product_id')
->label('Product')
->translateLabel()
->options(Product::query()->pluck('name', 'id'))
->required()
->reactive()
->afterStateUpdated(fn ($state, Forms\Set $set) => $set('unit_price', Product::find($state)?->price ?? 0))
->distinct()
->disableOptionsWhenSelectedInSiblingRepeaterItems()
->columnSpan([
'md' => 5,
])
->searchable(),
return Repeater::make('items')
->relationship()
->schema([
Forms\Components\Select::make('shop_product_id')
->label('Product')
->translateLabel()
->options(Product::query()->pluck('name', 'id'))
->required()
->reactive()
->afterStateUpdated(fn ($state, Forms\Set $set) => $set('unit_price', Product::find($state)?->price ?? 0))
->distinct()
->disableOptionsWhenSelectedInSiblingRepeaterItems()
->columnSpan([
'md' => 5,
])
->searchable(),
Can anyone help ? thanks!
23 replies
FFilament
Created by ingmontoya on 1/12/2024 in #❓┊help
Edit Lifecycle hooks ->before is not working
Hi, I'm trying to use the ->before() to add some logic to the record but is not being triggered. any ideas?
->actions([
Tables\Actions\EditAction::make()
->before(function ($record) {
$order = $record;
dd($order);
}),
])
->actions([
Tables\Actions\EditAction::make()
->before(function ($record) {
$order = $record;
dd($order);
}),
])
3 replies
FFilament
Created by ingmontoya on 12/27/2023 in #❓┊help
Create tenant menu
I'm trying to limit the number of tenants that a user can create, I have this code inside TeamPolicy:
public function create(): bool
{
$user = Auth::user();
$tenants = $user->team;
if (count($tenants) < Filament::getTenant()->allowedTenants()) {
return auth()->user()->role->name === 'administrador';
}
return false;
}
public function create(): bool
{
$user = Auth::user();
$tenants = $user->team;
if (count($tenants) < Filament::getTenant()->allowedTenants()) {
return auth()->user()->role->name === 'administrador';
}
return false;
}
The problem is, when the user attempts to create a new tenant (http://localhost/admin/new), the following code is returning null...
Filament::getTenant()
Filament::getTenant()
Any ideas?
8 replies
FFilament
Created by ingmontoya on 12/20/2023 in #❓┊help
navigationParentItem
in there a way to keep the navigation children always visible? Without using the navigation group.
20 replies
FFilament
Created by ingmontoya on 12/19/2023 in #❓┊help
Filament custom Registration Form
Hey Y'all, I did a custom register component to add a plan selection, made the relationship between users and plans and this is how it looks my register class:
class Register extends BaseRegister
{
public Plan $plan;
protected function getForms(): array
{
return [
'form' => $this->form(
$this->makeForm()
->schema([
$this->getNameFormComponent(),
$this->getEmailFormComponent(),
$this->getPasswordFormComponent(),
$this->getPasswordConfirmationFormComponent(),
$this->getRoleFormComponent(),
])
->statePath('data'),
),
];
}

protected function getRoleFormComponent(): Component
{
return Select::make('Plan')
->relationship(name: 'plan', titleAttribute:'name')
->native(false)
->default('estandar')
->required();
}
}
class Register extends BaseRegister
{
public Plan $plan;
protected function getForms(): array
{
return [
'form' => $this->form(
$this->makeForm()
->schema([
$this->getNameFormComponent(),
$this->getEmailFormComponent(),
$this->getPasswordFormComponent(),
$this->getPasswordConfirmationFormComponent(),
$this->getRoleFormComponent(),
])
->statePath('data'),
),
];
}

protected function getRoleFormComponent(): Component
{
return Select::make('Plan')
->relationship(name: 'plan', titleAttribute:'name')
->native(false)
->default('estandar')
->required();
}
}
however, I'm getting an error Call to a member function isRelation() on null https://flareapp.io/share/x7XZpMAm
6 replies
FFilament
Created by ingmontoya on 12/16/2023 in #❓┊help
reset password
No description
9 replies
FFilament
Created by ingmontoya on 12/1/2023 in #❓┊help
custom menu
Hi, I'm trying to create a Custom Nav Menu to display a Resource, but I'm getting a missing parameter: tenant
Filament::serving(function () {
Filament::registerNavigationItems([
NavigationItem::make('Consulta')
->url(PatientResource::getUrl(Filament::getTenant().'index'), shouldOpenInNewTab: false)
->icon('heroicon-o-presentation-chart-line')
->activeIcon('heroicon-s-presentation-chart-line')
->group('Configuración')
->sort(3),
]);
});
Filament::serving(function () {
Filament::registerNavigationItems([
NavigationItem::make('Consulta')
->url(PatientResource::getUrl(Filament::getTenant().'index'), shouldOpenInNewTab: false)
->icon('heroicon-o-presentation-chart-line')
->activeIcon('heroicon-s-presentation-chart-line')
->group('Configuración')
->sort(3),
]);
});
How can I pass the tenant to the url ? thanks!
7 replies
FFilament
Created by ingmontoya on 10/28/2023 in #❓┊help
is there a way to use tabs inside relationship manager?
Trying to use tabs inside relationship manager but not founding any documentation to accomplish that
13 replies
FFilament
Created by ingmontoya on 10/24/2023 in #❓┊help
custom summarizer
I've been trying to make a custom Summarizer with the using method but it doesn't receive a $record as a parameter and don't know how to pass the fk value, this is the code:
->using(
function (Builder $query) {
$records = $this->table->getRelationshipQuery()->whereKey('patient_id');
dd($records);
$sum = DB::table('service_patients')
->select(DB::raw('sum(services.cost_per_unit) as sumService'))
->leftJoin('services', 'service_patients.service_id', '=', 'services.id')
->where('service_patients.patient_id', 1)
->get();
return $sum[0]->sumService;
}
)
->using(
function (Builder $query) {
$records = $this->table->getRelationshipQuery()->whereKey('patient_id');
dd($records);
$sum = DB::table('service_patients')
->select(DB::raw('sum(services.cost_per_unit) as sumService'))
->leftJoin('services', 'service_patients.service_id', '=', 'services.id')
->where('service_patients.patient_id', 1)
->get();
return $sum[0]->sumService;
}
)
I only need to pass the
service_patients.patient_id
service_patients.patient_id
value but don''t know how. Any ideas?
3 replies
FFilament
Created by ingmontoya on 10/23/2023 in #❓┊help
Resource manager
No description
4 replies
FFilament
Created by ingmontoya on 10/18/2023 in #❓┊help
Do not send a TextInput value
This might sound weird, but is there a way to not send a data value in a field? Context: I have a disabled TextInput with a placeholder ( just to show information) but I don't want that value to be saved
7 replies
FFilament
Created by ingmontoya on 10/18/2023 in #❓┊help
Prefill field
No description
1 replies
FFilament
Created by ingmontoya on 10/14/2023 in #❓┊help
show/hide field depending on data load?
I'm trying to show a Repeater based on a Radio field, it's working fine but the problem is not working on first load, see video attached. I'm using live(), also tried with reactive() none of those works to get the data onload
8 replies
FFilament
Created by ingmontoya on 9/27/2023 in #❓┊help
Checklist values
Hi, I'm trying to show fields based on checklist selection, but I'm not sure how to retrieve those selected values. When using Radio it's much easier because I use: ->visible(fn (Get $get): bool => $get('question1') === 'yes') but how to do the same using CheckList ? I know checklist returns an array but not sure how to it
5 replies
FFilament
Created by ingmontoya on 9/27/2023 in #❓┊help
translate relation manager tabs
No description
17 replies
FFilament
Created by ingmontoya on 9/26/2023 in #❓┊help
Relationship Manager and Multitenancy
No description
25 replies