Cybrarist
Cybrarist
FFilament
Created by Cybrarist on 10/24/2023 in #❓┊help
relationship from another database
Hi guys, i am trying to use SelectFilter as a relationship between 2 entities where each one exists in its own database , so something like mysql_1.companies and mysql_2.tasks i have already set the connections in the models and relationship and everything works fine in select form where i can search and get the data. But when i use select filter it doesn't work where i get the following error
Base table or view not found: 1146 Table 'delivery.companies' doesn't exist (Connection: mysql, SQL: select count(*) as aggregate from `tasks` where (exists (select * from `companies` where `tasks`.`company_id` = `companies`.`id` and `companies`.`id` = 2)))
Base table or view not found: 1146 Table 'delivery.companies' doesn't exist (Connection: mysql, SQL: select count(*) as aggregate from `tasks` where (exists (select * from `companies` where `tasks`.`company_id` = `companies`.`id` and `companies`.`id` = 2)))
i have tried to add the connection name like ->relationship('mysql_1.companies') but it doesn't work neither right now i am doing the following
->query(function (Builder $query , $state){
if ($state['value'] ){
$query->where('company_id', $state);
}
})
->query(function (Builder $query , $state){
if ($state['value'] ){
$query->where('company_id', $state);
}
})
but i am not sure if this is a bug, or is there a specific option in select filter i can enable this. thank you for your help
3 replies
FFilament
Created by Cybrarist on 8/31/2023 in #❓┊help
Select options don't update when using "javascript" select
Hi, i am not sure if there's a better way, or i am using. wrong method, but here's what's happening. let's say i have an options array that is [1,2]. and it's passed to Select component ( array passed by value ). now if i update the options array in another component, let's say when i check a checkbox, i want to add the number 3 (the array is passed by reference) and i call the select component and pass the new array to it. it won't update if i used a js select ( when using a native(false) , multiple , searchable etc) but if i use it as normal html select, the values are updated. here's an example of what i mean The following example is working but i can't use multiple , searchable etc. Toggle Component
$test=[1,2]
Forms\Components\Toggle::make('variations')
->label("choose other variations to include")
->inline(false)
->reactive()
->afterStateUpdated(function ($component) use (&$test) {
$test[3] = 3;
$component->getContainer()
->getComponent('variation_options')
->options($test);
}),
$test=[1,2]
Forms\Components\Toggle::make('variations')
->label("choose other variations to include")
->inline(false)
->reactive()
->afterStateUpdated(function ($component) use (&$test) {
$test[3] = 3;
$component->getContainer()
->getComponent('variation_options')
->options($test);
}),
Select Component
Select::make('variation_options')
->key('variation_options')
->options($test)
Select::make('variation_options')
->key('variation_options')
->options($test)
BUT i can make it work by doing the following
$test=[1,2]
Forms\Components\Toggle::make('variations')
->label("choose other variations to include")
->inline(false)
->reactive()
->afterStateUpdated(function ($component) use (&$test) {
$test[3] = 3;
$component->getContainer()
->getComponent('variation_options')
->options($test)

->multiple()
->native(false);
}),
$test=[1,2]
Forms\Components\Toggle::make('variations')
->label("choose other variations to include")
->inline(false)
->reactive()
->afterStateUpdated(function ($component) use (&$test) {
$test[3] = 3;
$component->getContainer()
->getComponent('variation_options')
->options($test)

->multiple()
->native(false);
}),
As long as i initialize the select component as HTML input not a js select. so is is there a better way to do that, as i thought this might be a bug where the component should render the new value passed thanks in advance
1 replies
FFilament
Created by Cybrarist on 6/7/2023 in #❓┊help
Duplicate the row for many to many relationship in Model A List page
instead of showing ModelBs relationships with "," separating them, how can i tell filament to duplicate the whole row with the other relationship value. i tried custom column, it works fine if i kept it in the end where i can end the row as html, but is there a better way that i can achieve the above
22 replies