Gandalf
Using filters in a custom page
I'm trying to build a custom page (sort of a report), which will use a date range filter, and then fetch the data from various resources to display as per the selected date range. Since it requires custom formatting, so using Table Builder or Info List is not suitable.
Now, while I'm able to show the filters form by adding
FilterAction
to getHeaderActions()
and using HasFiltersAction
trait, I'm unable to figure out which method should I use to fetch and update the data on page as per the selected date range.
Could someone please help on this?3 replies
Using shadcn/ui for interface
I just want to know which UI library are we using under the hood, and is there a way to replace it with shadcn/ui instead?
This is because of a new admin panel project I've to work on, where the client is specifically looking for shadcn/ui at the front-end.
9 replies
Get another field from selected relationship record
Is there a way (apart from another db fetch) to get a different field for the relationship record from a select dropdown?
I've form fields like this:
Now, I wish to conditionally show owner_name field only if the selected category has its owner_name set as blank. Is there a way to do it without fetching the record from database?
1 replies
Get full path of FileUpload
I've defined a file upload field for uploading PDF to a model, as:
Now, I want to access this file after the model is created using
model::boot
method as below:
However, I get error as: File '01J085D4C9VX4Q2WSPFMTH95K8.pdf' does not exist.
How do I obtain the full path of this PDF file?2 replies
Transform record before import to database
I wish to store a list of CSV columns as a JSON object in a single column of database. What is the best way to do it?
I want to store the following 3 columns of CSV:
price
, quantity
, and brokerage
as a JSON object in the data
column of the record. I've tried setting the value in beforeFill
as below, but it doesn't work.
3 replies
Need to click twice to save
I'm using a simple resource (pop-up form) for a resource which has a few
live
numeric fields, and a Placeholder
field to display the calculated value. Every time I go about editing a record, I have to click twice on the save button for it to work.
Is this a known issue? Is there a workaround?2 replies
login page not found in production
Hello, I've deployed a very simple filament app to production, based on laravel 11. Since the new version of laravel doesn't come with auth, so I simply used filament login instead. Now, while the app seems to work alright in local development environment, when deployed to production, I'm getting 404 on /login route.
How do I ensure that filament auth is available on /login page?
6 replies
fillForm on Create Page?
I've created a duplicate action as below:
Now, while this works alright for a simple resource (pop-up forms), it doesn't fill the form in case of regular resource (individual create / edit pages).
What should I do differently for it to work for regular resource?
30 replies
Calculated input field in a form
I wish to include a calculated input field in a form, which is sum of a number of fields, some of which are dynamically included based on an attribute of the record. Although, I would calculate the value in the backend, I want to have the calculated value shown in the form itself while creation.
I've tried
evaluate()
method as well as state()
method both of which give Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
Is there a way to include such calculated fields?
Alternatively, how I can I include custom javascript only for the form of a particular resource? As then I can calculate the field value via javascript.63 replies
filament.exports.download giving 404 in multi-database multi-tenancy setup
I am using stancl/tenancy for multi database tenancy with filament. I've not enabled tenant features of filament itself, and instead relying on domain based tenancy provided by stancl/tenancy. I'm using the following configuration for tenancy:
In addition I'm using a custom
FileUrlMiddleware
with the following in handle
method:
This middleware is being used in routes/tenant.php
, config/livewire.php
, as well as in the TenantAdminPanelProvider
Also, during tenancy creation I'm setting the tenant public paths using a job, as below:
Base on this, all uploads for import are working fine, and data is getting imported alright. Similarly, when I'm trying to export the data, the files are getting created alright, such as: storage/tenant/0f7a82c3-f357-44f2-86c8-8e49e5bdc18f/app/public/filament_exports/1/0000000000000001.csv
which is linked from public/tenant/0f7a82c3-f357-44f2-86c8-8e49e5bdc18f/filament_exports/1/0000000000000001.csv
thanks to the above code.
However, the path http://tenant.app.test/filament/exports/1/download?format=csv
is giving 404.3 replies
Specifying navigation items order within navigation groups
How do I specify the navigation items order withing navigation groups?
I can order the navigation groups inside the panel using
navigationGroups()
method on the panel. However, how do I order individual navigation items within each of these navigation groups?4 replies
Authorize Imports: Apply different policy methods on create and update
I am using
authorize
method for Importer to show it only to the users that have create
authorization (via policy) for the respective model. However, as I'm setting records to be updated if a matching key already exists, I want update
policy authorization to be checked for in such cases. How can I apply update
authorization in such cases?
Basically, I want authorization method to differ depending on whether a new record is being created or an existing record is being updated1 replies
Replicate action: load form instead of save
I was searching for a way to add Clone table action, and came across Replicate action. The only difference between what I want and what this action offers is that, instead of saving the record directly, I want it to be loaded in the form instead, to be saved as a new record when Save button is clicked.
Is there a way to do this with Replicate action, or is there some other action to achieve this? I'm looking for a Save As action to be precise.
3 replies
How to specify ignoreRecord in unique rule in Import?
I've added an import action to a model with option to update existing record via
firstOrNew
method. Now, I wish to have the unique rule applied on a column, but only when the record is not being updated with the same value.
Typical laravel way for this is to ignore record with matching id. However, how do I specify this in the rules()
parameter for a column in getColumns
method of an Importer?4 replies
ImportPolicy
I wish to authorize imports of models based on model specific permissions. How can I control it using ImportPolicy?
For example, I've explicitly given a permission users.create to a particular role. Now, I wish only the users with that role to be able to import users data. Similarly, a roles.create permission exists for some other roles. And users with those roles should be able to import roles data.
3 replies