leoPascal
Please Help! Is it possible to show the images based on the selected option in create form?
Hello all,
In my orders form I want to give select field and when user select the customer_name, I want to display all related item_image for the selected customer below with 3 more fields which are barcode & item price as placeholder & quantity as input field for each item_image. I'm trying to achieve this with Viewfield with no succes as I never use this viewfield.
Please help me to achieve this.
8 replies
How to dynamically name uploaded images based on the number of images.
Hello,
In my V2 project I'm trying to upload images by giving name dynamically based on the number of image. I have tried like this
FileUpload::make('images')
->directory(function ($get) {
return 'craft-images/' . $get('cg_number');
})
->preserveFilenames()
->getUploadedFileNameForStorageUsing(function (TemporaryUploadedFile $file, $get): string {
$imageCount = count($get('images')) + 1;
$filename = "/img_{$imageCount}";
dd($filename);
return (string) $filename;
})->multiple()->enableReordering()
but dd($filename); gives me this below result
"/img_6"
I want to store something like this in the database
["\img_1", "\img_2", "\img_3", "\img_4", "\img_5", "\img_6",]
I would be thankful for any assistance.2 replies
Error while upgrading v2 to v3!
I'm getting the below error while upgrading. Any help would be appreciated. I have "StackedImageColumnServiceProvider.php" pluggin
"In StackedImageColumnServiceProvider.php line 8:
Class "Filament\PluginServiceProvider" not found"
2 replies
Is it possible to hide selected row from table in filament v2?
Hello Filamenters,
I was just wondering if it is possible to hide a selected row, similar to how we can delete the selected row by clicking on the three vertical dots in the top left of the table. If yes, how can I achieve this?
Thank you in advance for your time.
3 replies
Error while Displaying Multiple Images in the table column.
In my Filament V2 project, I have already uploaded multiple images using multiple() and defined protected $casts, inserted successfully in the database as an array like this
["y1.jpg", "y2.jpg", "y3.jpg"]. Now, I want to display these images in a table as stacked images or at least as a single image. However, I'm encountering this error: 'League\Flysystem\Filesystem::has(): Argument #1 ($location) must be of type string, array given'. Any help would be greatly appreciated.
//below is the code
FileUpload::make('images')
->preserveFilenames()
->getUploadedFileNameForStorageUsing(function (TemporaryUploadedFile $file): string {
return (string) str($file->getClientOriginalName())->prepend('image') . '_');
})->multiple()
//trying to display like this
->columns([
ImageColumn::make('images'),
])`2 replies
how can I insert the placeholder value into database?
I'm using filament-v2, in my create form I have a few calculative fields for which I'm using placeholders and I want these calculative values to get inserted into the database along with other field values of the form. What's wrong with my code, any help would be appreciated.
TextInput::make('premium')->label('Premium Amount'),
TextInput::make('no_passengers')->numeric()->label('Number of Passengers')
->reactive(),
Placeholder::make('prsnl_acdnt_prm')->label('Personal Acc. Premium')
->reactive() ->content(
function ($get) {
$pap = $get('no_passengers') * 200;
return $pap;
}),
Placeholder::make('total_premium')->label('Total Premium Amount')->reactive()
->content(
function ($get) {
$pap = $get('no_passengers') * 200;
$sum = $get('premium') + $get('prsnl_acdnt_prm') + $pap;
return $sum;
})
7 replies
how can I hide a form field which is $fillable in the model.
In my form, I have a field called department_id and I want to make it hidden() as I have another field called department_name which is displaying but disabled(). While doing so I'm getting this error "SQLSTATE[HY000]: General error: 1364 Field 'department_id' doesn't have a default value".
Upon exploring this I got this "https://discord.com/channels/883083792112300104/1152158647590342696" but I'm so sorry I don't know how I can use this
mutateFormDataBeforeCreate() function in my case.
TextInput::make('department_id')->label('Department')->hidden(),
TextInput::make('department_name')->label('Department')->disabled(),
61 replies
How can I change the font-size of heading in Apexchart in my Filament project?
I tried something like this... works fine but it give me 2 headings, first with h2 and another with fontSize = 12px.
$chartTitle = static::$heading;
return [
'series' => $series,
'chart' => [
'type' => 'line',
'height' => 300,
],
'xaxis' => [
'categories' => $xAxisCategories,
'labels' => [
'style' => [
'colors' => '#9ca3af',
'fontWeight' => 600,
],
],
],
'yaxis' => [
'labels' => [
'style' => [
'colors' => '#9ca3af',
'fontWeight' => 600,
],
],
],
'colors' => ['#ffc107'],
'stroke' => [
'curve' => 'smooth',
],
'title'=> [
'text'=> $chartTitle,
'align'=> 'left',
'margin'=> 10,
'offsetX'=> 0,
'offsetY'=> 0,
'floating'=> false,
'style'=> [
'fontSize'=> '12px',
'fontWeight'=> 'bold',
'fontFamily'=> 'undefined',
'color'=> '#263238'
],
]
];
2 replies
How to generate PDF using DomPDF?
Hello Filament community,
I'm new to Filament and I have a question. In my Filament project, I need to export filtered data to a PDF using DomPDF. Currently, I'm able to export the entire set of 10 records from the database. However, when I apply a filter, all 10 entries continue to appear in the exported PDF. I want to export only the filtered data, which are about 3 entries, and generate a PDF. Could someone please assist me with this?
61 replies