ehbfa
Duplicate widgets on dashboard (with properties)
Hey,
I'm trying to have multiple widgets on the dashboard. But if you duplicate a class in the widgets() array in the AdminPanelProvider, it gets ignored. So I think I could do something via the getWidgets() method in my own Dashboard class. And then return a couple of widgets (which can be duplicates it seems). But to pass a property to that class (to tell the class what question it is linked to) I would have to use a WidgetConfiguration I guess? I tried something like this;
new WidgetConfiguration('App\Filament\Widgets\TenantCards', [
'test' => 'hello',
]),
But then when I do this;
dd($this->getPropertyValue('hoi'));
i get:
Property [$test] not found on component: [app.filament.widgets.tenant-cards]
So how would I fetch that property? And know within that class which question it is referring to?
3 replies
Having viewData with value of another field available
Hi,
I'm trying to get the value of a hidden field within another field (which is just a view). Here is my code;
return $form
->schema([
Forms\Components\Hidden::make('test')
->default('hello),
Forms\Components\ViewField::make('another')
->view('forms.components.another')
->viewData(['test' => function(callable $get) { $get('test'); }, ]),
]);
I hoped that $get would be called and give me the value of the field available in my view, but when I do this in my view;
@php
dump($test)
@endphp
I get:
Closure(callable $get) {#2840 ▼ // resources/views/forms/components/another.blade.php
class: "App\Filament\Resources\ProjectResource"
}
And not the value "hello"?
8 replies
Is there a way to reload all widgets on the Dashboard, based on a <select>?
Heya! I'm having a period filter widget, which should control all the other widgets on the dashboard. Once a date is selected, the <select> gets changed, I want all the widget to reload, based on the selected month. How would one go about doing that?
4 replies
Open up a modal from a dashboard widget
Heya! I've got a widget which displays some text and at the end a button. When the user clicks that button, I want to open a modal window. Now I think stuff like this is possible, when I look at this: https://filamentphp.com/docs/3.x/support/blade-components/modal#controlling-a-modal-from-javascript - but my two questions are;
1) Where to place that modal HTML, that it can be accessed via JS? How/where do I register it, so it becomes available in the DOM, for JS to access it? Or am I missing something about how this all works.
2) Can I just load in other HTML in that modal as well? As the modal will have additional buttons that needs to be pressed to progress the flow within that modal.
I'm sorry for these newbee questions, but I'm mostly a backend dev, and not too familiar with Livewire or Alpine... So some pointers on where to place the content provided in that example and get me started is much appreciated!
47 replies
Can you hide the default menu but still discover the resources?
I have my own
navigationItems
array - and I only want to see those items in the navigation. In Filament2 it was enough to create a Filament::navigation
in my AppServiceProvider
, but in Filament3 the resources also get added to the menu. Now I saw that I could disable the resource discovery, and it would not create the default menu, but then the resources also are not available in the php artisan route:list command. And I need to have them available in order to link to them. Is there some other function that I'm missing when creating the panel/nav? I could not find this in the documentation, but maybe I am overlooking something4 replies
...CompanyResource::getNavigationItems() gives "Call to a member function getId() on null"
I'm using these kind of lines in my
navigationItems
method in my AdminPanelProvider
: ...CompanyResource::getNavigationItems()
, but that seems to be broken in filament3? I want to add a couple of items in the navigation via this way (and basically create my own custom navigation instead of the auto generated one)3 replies
Route [filament.admin.pages.dashboard] not defined.
I have a custom Dashboard page:
And it registers itself, as I can see in the sail artisan route:list command:
So the name it is given is filament.admin.pages.dashboard. But when I do this call in
AdminPanelProvider
:
I get the error Route [filament.admin.pages.dashboard] not defined. ?10 replies
Is this the best way to add a class to a custom widget?
Hey! I've got a custom widget, that I want to style separatly from the other widgets on the dashboard. So in order to do that, I want to get an identifier or class high enough up in the DOM to access it correctly.
Currently, I'm doing it like this, which works for me - but I am wondering if this is the correct approach?
<x-filament::widget>
<div class="my-custom-class">
<x-filament::card>
{{-- Widget content --}}
</x-filament::card>
</div>
</x-filament::widget>
Any ideas on how to improve on this? Because ideally I would even be one DOM element higher than that with my class definition 🙂
3 replies
How to put extra content (intro text) in a RelationManager that is tabbed?
I have a resource with two RelationManagers in the getRelations method, which are displayed in tabs. In the second RelationManager I want to show an intro text when that tab is activated, somewhere in the header (below the title for example). How could I achieve this?
2 replies
Can you edit a relation from within a relation? I have pages > questions > answers
Hey, I want to be able to edit a page. Then see the questions which are related to that page and edit them. I can do that via:
public static function getRelations(): array
{
return [
RelationManagers\QuestionRelationManager::class,
];
}
But then I want to have the answers which are related to that question, also be editable.
Is such a thing possible? Edit a relation of a relation?
4 replies
getTableColumns with conditional columns based on the record/row parents type
Heya, I want to define some columns in a table. I think I need to use the getTableColumns function in my ListSettingValues class. But how can I make these columns conditional, based on the data in the setting value's parent? I want to show a text column for normal values but an image column for uploads. In my EditSettingValue class, I could do this with the getFormSchema method, and then have an if based on the $this->record var.
5 replies