Rahul
DateTimePicker Issue
I am using DateTimePicker field i am using its timezone method i need to show in ui date time in according to timezone() but in db it should save in utc
my timezone is 'Asia/Kolkata' its working for that its showing in ui my timezone and saving date in utc in db too
but if i put any other time zone its not working its showing time as my local timezone and also not saving data in utc.
Forms\Components\DateTimePicker::make('start_time')
->timezone(config('app.user_timezone'))
->required(),
2 replies
Error Displaying '[object Object]' in Video Link Field When Switching Upload Options
I have a select field named 'video type,' with two options: 'upload by link' and 'file upload.' When I choose an option, it displays the corresponding field. However, I encounter an issue: when I select 'file upload' and upload a file, and then switch to the 'upload by link' option in the 'video type' field, the 'video link' field displays '[object Object]' in array format. How can I fix this?
Here's my code:
Select::make('video_type')
->reactive()
->options([
"link" => "Upload By Link",
"upload" => "File Upload"
]),
TextInput::make('video_url')
->id('link-field')
->required()
->reactive()
->hidden(fn (Closure $get) => empty($get('video_type')) || $get('video_type') == "upload")
->afterStateHydrated(
function ($state, $component, $record) {
if ($state) {
return $component->state($state);
}
}
),
FileUpload::make('video_url')
->id('upload-field')
->required()
->reactive()
->hidden(fn (Closure $get) => empty($get('video_type')) || $get('video_type') == "link")
->disk('local')
->afterStateHydrated(
function ($state, $component, $record) {
if ($state) {
return $component->state($state);
}
}
),
I want the field name 'video_url' to be used for both file upload and text input, as I intend to store my link in that field.3 replies
Custom Action Buttons Policy Conflict
use Filament\Pages\Actions\Action;
I have created a custom 'Edit' action button in the table action section of the resource, and also created a custom 'Create' action button on the list page. Due to this setup, my policy is not working as intended. This means that within the 'viewAny' permission, it includes both editing existing records and creating new ones
4 replies
Select Field Options Key And Value
i have select options like this
Select::make('game')
->options([
"f" => "football",
"c" => "cricket",
]),
and i do want to modify the key value i.e f,c
so as in database it save with key value i.e f,c so in the list page table column it showing me with that key value i.e f,c
but i want in table column it show me football,cricket like that.
so how to fix this ??
5 replies
File Upload Issue with Avatar: MaxSize Validation Not Working
In the file upload, I use avatar() and apply maxSize(1024) for validation. However, the maxSize validation is not working when I am using the avatar.
here is the code:
FileUpload::make('profile_image')
->label('')
->image()
->avatar()
->panelAspectRatio('1:1')
->panelLayout('integrated')
->maxSize(1024)
->columnSpanFull(),
4 replies
Troubleshooting Default Value Display in Custom Resource Page
I have built a custom resource page, and inside it, I have a 'mount' function. However, the default value doesn't appear when I click on the 'Send Email' button and I want to be able to edit the page after receiving the default value and save the edited data in the database. How can I do this?
5 replies
Execution Order Change Causing Filter Value Mismatch in Filament-v3 Widget
I have designed a filter inside a widget that extends from TableWidget. Within this widget, I have implemented two functions: getTableQuery() and getTableFilters().
Now, I am in the process of upgrading this widget from Filament-v2 to Filament-v3. In Filament-v2, getTableFilters() is executed first, and based on its output, getTableQuery() is subsequently executed. However, in Filament-v3, the order of execution has changed. It now directly executes getTableQuery, and this change is causing issues, as when I select a value from the filter, the data is not fetched correctly.
Is there any alternative method or solution available that would allow me to access the current filter value?
in the v2 it is written like this
$month_selected = $this->getTableFilterState("attendance_month")["value"];
while getTableFilterState() is not working in v3 so in the v3 i write like this $month_selected = $this->tableFilters['attendance_month']['value'];
Initially, when I dump $month_selected in version 3, it returns a null value. However, after selecting another month, such as April, and then dumping $month_selected, it displays the previously selected month, in this case, October.
and also when i dd($this->tableFilters) it returns a null value.
In Filament-v2, getTableFilters() executes first, and then getTableQuery(), which works perfectly. In Filament-v3, getTableQuery() executes first, causing this issue. Any insights on how to address this problem would be greatly appreciated.20 replies