bernhard
bernhard
FFilament
Created by bernhard on 2/17/2025 in #❓┊help
Key-value Field with dot in key
No description
49 replies
FFilament
Created by bernhard on 2/6/2025 in #❓┊help
$set on modal form hint action
In my resource I have a field with an hintAction, which opens a modal. In the modal, there is a field with a hintAction. This hintAction should set the value of a resource field to the value of the modal field. So this is the hintAction inside the modal:
$key = "teaser";

return Action::make('Übernehmen')
->action(function ($state, $set) use ($key) {
Notification::make()
->title("AI Content \"$key\" übernommen ")
->success()
->send();

return $set($key, $state);
});
$key = "teaser";

return Action::make('Übernehmen')
->action(function ($state, $set) use ($key) {
Notification::make()
->title("AI Content \"$key\" übernommen ")
->success()
->send();

return $set($key, $state);
});
This doesn't work. It shows the notification, but doesn't change the teaser content. I guess its because the $set is for the modal form, not the resource form?
3 replies
FFilament
Created by bernhard on 1/31/2025 in #❓┊help
Notifications with links in it - weird autofocus
No description
8 replies
FFilament
Created by bernhard on 1/30/2025 in #❓┊help
Categorize database notifications
I am using Filament notifications for my admin panel, as well as for the frontend. Now I am writing a cronjob, to delete old notifications. But they should have different prune times. For example the ones from frontend 7 days, the one from panel 30 days, etc. Is there a way for me to categorize the notification (when sending it) so that I can handle it differently when deleting it? And bonus question: What is the "type" in the notificationstabelle good for? Its always Filament\Notifications\DatabaseNotification
4 replies
FFilament
Created by bernhard on 1/24/2025 in #❓┊help
Best way to organize large amount of resources in navigation
I have a lot of resources (currently 38) in my admin panel. Right now, I have organized them in a couple of NavigationGroups. This works, but its still a bit confusing for my customers, since the sidbar is getting very long and then sometimes don't know in which group the find a specific resource. In the near future, the number of resources will grow. Any suggestions how to solve this issue? Is there maybe an option/plugin to "filter" the sidebar-navigation? Or can I have another (sub)level of the navigation?
6 replies
FFilament
Created by bernhard on 12/9/2024 in #❓┊help
Notifications not shown on redirect
I am trying to implement notifications outside the panel. Why isn't any notification shown when using redirects ?
Route::get("test", function(){
Notification::make()
->body("test")
->title("test")
->success()
->send();
return redirect("/");
});
Route::get("test", function(){
Notification::make()
->body("test")
->title("test")
->success()
->send();
return redirect("/");
});
Without redirects, it works (so yes, I have added @livewire('notifications') to the template. My current usecase is verifying a registered email address and then redirect to the homepage, where I wanna show the user a notification, that it was a success.
5 replies
FFilament
Created by bernhard on 12/5/2024 in #❓┊help
Action not triggering
I have a simple Livewire Component:
class UserIcon extends Component implements HasForms, HasActions
{
use InteractsWithActions;
use InteractsWithForms;


public function userMenuOrLogin(): Action
{
return Action::make('login')
->action(function (array $arguments) {
dd('Test action called', $arguments);
});
}


public function render(): View
{
return view('livewire.user-icon');
}
}
class UserIcon extends Component implements HasForms, HasActions
{
use InteractsWithActions;
use InteractsWithForms;


public function userMenuOrLogin(): Action
{
return Action::make('login')
->action(function (array $arguments) {
dd('Test action called', $arguments);
});
}


public function render(): View
{
return view('livewire.user-icon');
}
}
and thats the view:
<div>
{{ $this->userMenuOrLogin }}
<x-filament-actions::modals />
</div>
<div>
{{ $this->userMenuOrLogin }}
<x-filament-actions::modals />
</div>
When I click on the button, I can see the update request on the network tab of chrome, but nothing happens, no DD output is shown. Any ideas?
3 replies
FFilament
Created by bernhard on 8/10/2024 in #❓┊help
Hint Action - Copy value
I wanna add a hint action to a Builder field, which should copy the $state into the browser clipboard. This is what I got so far:
->hintAction(Action::make('copyJson')
->label("Inhalt exportieren")
->icon('heroicon-m-clipboard')
->action(function (Get $get, $state) {
dd(json_encode($state, JSON_PRETTY_PRINT));
}),
),
->hintAction(Action::make('copyJson')
->label("Inhalt exportieren")
->icon('heroicon-m-clipboard')
->action(function (Get $get, $state) {
dd(json_encode($state, JSON_PRETTY_PRINT));
}),
),
This already show the button and on click it dd's the json of the Builder field state. But how to copy the value to clipboard, instead of dding? How can I call JS navigator.clipboard.writeText(copyText.value);? Just to understand, what I wanna achieve: Later I will change it to
->hintAction(fn() => [
Action::make('copyJson')
->label("Inhalt exportieren")
->icon('heroicon-m-clipboard')
->action(function (Get $get, $state) {
...
}),
Action::make('importJson')
->label("Inhalt importieren")
->icon('heroicon-m-arrow-down-on-square')
->form(fn($state) => [
TextArea::make('copyJsonTextarea')
])
->action(function (Get $get, $state) {
...
})
])
->hintAction(fn() => [
Action::make('copyJson')
->label("Inhalt exportieren")
->icon('heroicon-m-clipboard')
->action(function (Get $get, $state) {
...
}),
Action::make('importJson')
->label("Inhalt importieren")
->icon('heroicon-m-arrow-down-on-square')
->form(fn($state) => [
TextArea::make('copyJsonTextarea')
])
->action(function (Get $get, $state) {
...
})
])
so that I can import/export the Builder value.
4 replies
FFilament
Created by bernhard on 8/1/2024 in #❓┊help
Action outside of the panel not showing modals
I have a component outside of the panel:
class Search extends Component implements HasForms, HasActions
{
use InteractsWithActions;
use InteractsWithForms;


public function render(): View
{
return view('livewire.search');
}


public function deleteAction(): Action
{
return Action::make('delete')
->requiresConfirmation()
->action(fn () => dd(1));
}
}
class Search extends Component implements HasForms, HasActions
{
use InteractsWithActions;
use InteractsWithForms;


public function render(): View
{
return view('livewire.search');
}


public function deleteAction(): Action
{
return Action::make('delete')
->requiresConfirmation()
->action(fn () => dd(1));
}
}
<div>
{{ $this->deleteAction }}
</div>
<div>
{{ $this->deleteAction }}
</div>
When clicking on the button, nothing happens, no confirm modal is shown. In Dev-Toolbar I see no error. Only thing I can see is that the attribute disabled=true is set for a second. When I now remove the ->requiresConfirmation() and click again, I can see the dd output. Same goes for custom modals - the modal isn't show. Nothing happens:
Action::make('delete')
->form([
TextInput::make("search")
])
->action(fn () => dd(1));
Action::make('delete')
->form([
TextInput::make("search")
])
->action(fn () => dd(1));
9 replies
FFilament
Created by bernhard on 3/21/2024 in #❓┊help
Filament v2 - Color picker lazy/debounce
I am using filament v2 and I have a colorpicker field. Since I use the value of this field in another field, the field is reactive:
ColorPicker::make('color')->reactive()
ColorPicker::make('color')->reactive()
This works, but I just wanna get updates, after the color was picked and not on moving the circle of the colorpicker around. Neither lazy() nor debounce("5000ms") works? Is this a bug?
2 replies
FFilament
Created by bernhard on 3/6/2024 in #❓┊help
Weird login error after livewire update
After composer update I can't login to filament. I see the login form but the password field is a regular input field (i can see the password when typing) and when clicking on the login button, I get The POST method is not supported for route admin/login. Supported methods: GET, HEAD. I could track it down to the latest release (3.4.7) of livewire. When doing
composer require livewire/livewire:v3.4.6 -W
composer require livewire/livewire:v3.4.6 -W
It is working again. Has anyone seen this issue? Is this Filament or Livewire related?
4 replies
FFilament
Created by bernhard on 1/31/2024 in #❓┊help
FileUpload in process, how to disable button outside panel?
I have an v2 form outside the panel with an FileUpload. How to disable a submit button, while FileUpload is ongoing? wire:loading.attr="disabled" is only working for the save process itself, but not for the uploading in background. This is what I have tried atm:
<button wire:click='submit' wire:loading.attr="disabled">
Save
</button>
<button wire:click='submit' wire:loading.attr="disabled">
Save
</button>
1 replies
FFilament
Created by bernhard on 1/22/2024 in #❓┊help
"Create another" and prefill field
When creating a new record in the panel and clicking on the "create & create another" button, is there a way to reuse some of the values of the current fields for the new "new form"? For example, I have the following fields - name (string) - category_id (Select with relationship) - country_id (Select with relationship) When a user now types/selects: - name: XYZ - category_id: 1 - country_id: 4711 and clicks on the "create & create another" button, the entry is saved and he is redirected to a new and empty "Create" form. I want that the new "Create" form is now prefilled with - category_id: 1 - country_id: 4711 Possible?
5 replies
FFilament
Created by bernhard on 1/16/2024 in #❓┊help
Problem with remember per page setting
No description
2 replies
FFilament
Created by bernhard on 1/10/2024 in #❓┊help
Can't use svg in TextColumn
What I want to achive is a column which shows an icon and when you click on it, a defined text is copied to the clipboard. The problem is, that the IconColumn has no copyable method, so I tried to use the TextColumn:
TextColumn::make("copy_column")
->getStateUsing("Copy")
->copyable()
->copyableState(fn($record) => $record->id)
TextColumn::make("copy_column")
->getStateUsing("Copy")
->copyable()
->copyableState(fn($record) => $record->id)
this works as expected and it shows the text "Copy". Now I tried to use an icon:
TextColumn::make("copy_column")
->getStateUsing(function() {
return new HtmlString(
'<svg style="width: 20px; height: 20px;" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"></path>
</svg>');
})
->html()
->copyable()
->copyableState(fn($record) => $record->id)
TextColumn::make("copy_column")
->getStateUsing(function() {
return new HtmlString(
'<svg style="width: 20px; height: 20px;" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"></path>
</svg>');
})
->html()
->copyable()
->copyableState(fn($record) => $record->id)
but the column is empty. Any ideas?
31 replies
FFilament
Created by bernhard on 12/12/2023 in #❓┊help
Property type not supported in Livewire when using computedProperties
I tried to create a resource for some third party model (Spatie\UptimeMonitor\Models\Monitor). This model uses the following method:
public function getUrlAttribute(): ?Url
{
if (! isset($this->attributes['url'])) {
return null;
}

return Url::fromString($this->attributes['url']);
}
public function getUrlAttribute(): ?Url
{
if (! isset($this->attributes['url'])) {
return null;
}

return Url::fromString($this->attributes['url']);
}
On edit page, I get now an exception Property type not supported in Livewire for property: [{}] The weird thing is, that i get this exception, even if I dont use the url property at all in the form:
public static function form(Form $form): Form
{
return $form
->schema([]);
}
public static function form(Form $form): Form
{
return $form
->schema([]);
}
When commenting the getUrlAttribute out from the package, the error isn't thrown. Any ideas how to get around this error, without messing up the package?
6 replies
FFilament
Created by bernhard on 11/20/2023 in #❓┊help
Widget with filter - mobile
No description
6 replies
FFilament
Created by bernhard on 11/17/2023 in #❓┊help
Allow comma sign in TagsInput
Is there a way, to allow a comma sign in an TagsInput value? As soon as I enter a comma sign "," in the TagsInput, the tag is added. But I just wanna add for example names as tags in the format - "John, Doe" - "Foo, Bar" - "Jean-Claude, Van-Cool" So is there a way, do disable tag recognition with ",", and just use Enter (or change it to semicolon)
3 replies
FFilament
Created by bernhard on 11/4/2023 in #❓┊help
Issues beeing automatically closed for no reason
I have created this issue https://github.com/filamentphp/filament/issues/9459 on github, but the bot closed it 1 minute after. I have provided all necessary informations, I created a repo to reproduce. What did I wrong?
6 replies
FFilament
Created by bernhard on 10/22/2023 in #❓┊help
Disable buttons and fields, while loading
What is the best/prefered way of disableing the form fields and buttons, while a submit request is done? I am talking about v2 and (standalone) form, not admin-panel
2 replies