yagrasdemonde
yagrasdemonde
FFilament
Created by yagrasdemonde on 10/10/2024 in #❓┊help
Issue with livewire component (a table) in Infolist
Summary : After calling an action, devtools console shows error like :
Uncaught (in promise) Component not found: uVTyoagOvbBWvJbGHy4J
Uncaught (in promise) Component not found: uVTyoagOvbBWvJbGHy4J
Filament : 3.2.117 Laravel : 11.27.2 In Post View Page, a livewire table component is shown. I set a button to 'cancel' a post. This button save a relationship to define a cancelation. When a post is canceled, a section appears to indicate this state. Inside it, a button permit to cancel this 'cancelation'. After action of this button, error appears in devtools console - and this is the issue - I made a repo to demonstrate this issue. https://github.com/agencetwogether/filament-livewire-component-error Thank you for taking time to see this and your feedbacks
3 replies
FFilament
Created by yagrasdemonde on 9/30/2024 in #❓┊help
Group Options in record Select in Relation Manager
Hello, I'm trying to achieve to group options in Select record input in AttachAction in Relation Manager, but I have an error :
Method Illuminate\Support\Collection::getQuery does not exist.
Method Illuminate\Support\Collection::getQuery does not exist.
`
Tables\Actions\AttachAction::make()
->recordSelectOptionsQuery(function (Builder $query) {

return $query->get()->groupBy('season')->map(function ($item) {
return $item->keyBy('id')->map(fn ($item) => $item->title);
});

})
Tables\Actions\AttachAction::make()
->recordSelectOptionsQuery(function (Builder $query) {

return $query->get()->groupBy('season')->map(function ($item) {
return $item->keyBy('id')->map(fn ($item) => $item->title);
});

})
In Database I have a column
season
season
and so I would like to group options by season when I choose a record to attach. In doc, (https://filamentphp.com/docs/3.x/forms/fields/select#grouping-options) to group options; values must be formatted like in example. Doing
dd($query->get()->groupBy('season')->map(function ($item) {
return $item->keyBy('id')->map(fn ($item) => $item->title);
}));
dd($query->get()->groupBy('season')->map(function ($item) {
return $item->keyBy('id')->map(fn ($item) => $item->title);
}));
I have the good format. Any help will be welcome. Thanks
6 replies
FFilament
Created by yagrasdemonde on 3/10/2024 in #❓┊help
Render Hook in middleware problem
Hello, I'm trying to show a custom message before login form with middleware if user is not active. But no success... I create a custom Middleware
CheckIsActive
CheckIsActive
to replace Authenticate in authMiddleware array of my
```php
->authMiddleware([
CheckIsActive::class,
//Authenticate::class,])
```php
->authMiddleware([
CheckIsActive::class,
//Authenticate::class,])
use Filament\Http\Middleware\Authenticate;
class CheckIsActive extends Authenticate
{
protected function authenticate($request, array $guards): void
{
$auth = Filament::auth();
$user = $auth->user();
$panel = Filament::getCurrentPanel();

if (! ($auth->check()
&& $user instanceof FilamentUser
&& $user->canAccessPanel($panel)
&& $user->is_active)) {
Session::flush();
FilamentView::registerRenderHook(
'panels::auth.login.form.before',
fn (): View => view('filament.views.general.hook-before-login')
);
$this->unauthenticated($request, $guards);
}
}

protected function redirectTo($request): ?string
{
return Filament::getLoginUrl();
}
}
use Filament\Http\Middleware\Authenticate;
class CheckIsActive extends Authenticate
{
protected function authenticate($request, array $guards): void
{
$auth = Filament::auth();
$user = $auth->user();
$panel = Filament::getCurrentPanel();

if (! ($auth->check()
&& $user instanceof FilamentUser
&& $user->canAccessPanel($panel)
&& $user->is_active)) {
Session::flush();
FilamentView::registerRenderHook(
'panels::auth.login.form.before',
fn (): View => view('filament.views.general.hook-before-login')
);
$this->unauthenticated($request, $guards);
}
}

protected function redirectTo($request): ?string
{
return Filament::getLoginUrl();
}
}
If user is not active, redirect works but my view for auth.login.form.before hook is not showed What I'm missing ?
4 replies
FFilament
Created by yagrasdemonde on 2/29/2024 in #❓┊help
Problem refreshing component
Hello, I have a problem with refreshing component. In my EditProfile page, I dispatch an event, but my other component in top bar not refreshing. My goal is to hide this button when profil is complete. This is what I tried.
10 replies
FFilament
Created by yagrasdemonde on 2/12/2024 in #❓┊help
Possible to use configureUsing for Filament\Tables\Actions\ActionGroup ?
Hello, Is it possible to customize globally ActionGroup to display link() mode ?
4 replies
FFilament
Created by yagrasdemonde on 12/21/2023 in #❓┊help
Using many settings group in one page with Tabs ?
Do you know if is it possible to have in each tab of a form, a specific group defined with #spatie-settings ? For example I have 2 settings classes in
app/Settings
app/Settings
like
ContentSettings
ContentSettings
and
GeneralSettings
GeneralSettings
. For each,
function group()
function group()
return a different group name In
app/Filament/Pages/Content.php
app/Filament/Pages/Content.php
I define my form with tabs, first one is for content settings, and second, there is a way to put general settings fields and save them in database ? Is it possible or each group must have its own page ? Thank you
2 replies
FFilament
Created by yagrasdemonde on 12/19/2023 in #❓┊help
Get all colors to create a select element
Hello Filament's lovers. Is there a way to get colors defined in
tailwind.config.js
tailwind.config.js
(default tailwind and extended) in array ? I'd like to build a select element to pick one in form. If not, do you have any tips to get colors to accomplish this ?
8 replies
FFilament
Created by yagrasdemonde on 8/14/2023 in #❓┊help
Can use custom color in select multiple ?
5 replies
FFilament
Created by yagrasdemonde on 4/17/2023 in #❓┊help
SpatieMediaLibraryFileUpload inside createOptionForm()
Hello, I have an exception when I save record with SpatieMediaLibraryFileUpload inside createOptionForm => Call to undefined method App\Models\MealItems::getMedia() Explanation : I have a form to save a meal. Inside it, I have a repeater to insert many dishes. To do that I use
Forms\Components\Repeater::make('items')->schema([
Forms\Components\Select::make('dish_id')->options(Dish::pluck('name', 'id'))->createOptionForm([
...
SpatieMediaLibraryFileUpload::make('media')
->label('Image')
->collection('dishes-images')
->image()
])
->createOptionUsing(fn ($data) => Dish::create($data)->getKey())
])
Forms\Components\Repeater::make('items')->schema([
Forms\Components\Select::make('dish_id')->options(Dish::pluck('name', 'id'))->createOptionForm([
...
SpatieMediaLibraryFileUpload::make('media')
->label('Image')
->collection('dishes-images')
->image()
])
->createOptionUsing(fn ($data) => Dish::create($data)->getKey())
])
When I create new dish by clicking + button, a modal opens, all fields are saved in dishes table after submit, and this record is set to dish_id select of meal form but not my image in media table. Then when I try to edit this meal, back to create a new dish clicking + button, and after submit button modal, I get this error Call to undefined method App\Models\MealItems::getMedia(). In fact is normal since HasMedia is in Dish model and not MealItems Forms\Components\Repeater::make('items') items is the name of my relationship How do I say to spatie to get ID of Dish created to permit to save image in media table ? Thank you
30 replies
FFilament
Created by yagrasdemonde on 4/14/2023 in #❓┊help
How to customize Title of Modal when use createOptionForm()
Hello, Is there a way to customize modal title after clicked on + near select field with createOptionForm() method ? And so, the tooltip of + button shows always "Create option" (<span class="sr-only">Create option</span>), any tip to customize it ? Thanks
62 replies
FFilament
Created by yagrasdemonde on 4/11/2023 in #❓┊help
Select component with searchable() inside in Repeater component with orderable()
Hello, in my project and in filament demo, when I use Select component with searchable() method in Repeater component with orderable() method I have screen bug in Safari 16.4 (macOS 13.3.1) during sorting repeater item. If I remove searchable, no problem! Forms\Components\Repeater::make('items') ->relationship() ->schema([ Forms\Components\Select::make('dish_id') ->label('Dish') ->options(Dish::pluck('name', 'id')->toArray()) ->required() ->searchable() ->preload() ->lazy(), ]) ->orderable('sort') ->collapsible() ->required(), Also if I collapse repeater items, no problem See video below Thanks
1 replies