F
Filament3mo ago
Daniel

the file does not appear in the repeater fileUpload (Custom Page)

I have this repeater(photo 1) and a i have this data (photo 2) code:
Repeater::make('paid_amounts')
->model(PaidAmount::class)
->schema([
Grid::make(3)
->schema([
TextInput::make('name')
->translateLabel()
->columnSpan(1)
->extraAttributes(['class' => 'form-input']),
MoneyInput::make('value')
->translateLabel()
->columnSpan(1)
->extraAttributes(['class' => 'form-input']),
FileUpload::make('photo')
->imageEditor()
->image()
->translateLabel()
->columnSpan(1),
Actions::make([
Action::make('save')
->icon('heroicon-o-archive-box-arrow-down')
->color('success')
->action(function ($state) {
//new instance of paymentService based in fixed_order_id of select
$paymentService = new PaymentService(
FixedOrder::find($this->data['fixed_order_id'])->payment
);
//create a paid amount and return a instance of it service
PaidAmountService::create(
data: $state,
payment: $paymentService
);
})
])->verticalAlignment(VerticalAlignment::End),
Toggle::make('is_approved')
->translateLabel()
->columnSpan(1)
->extraAttributes(['class' => 'form-toggle']),
])
])
Repeater::make('paid_amounts')
->model(PaidAmount::class)
->schema([
Grid::make(3)
->schema([
TextInput::make('name')
->translateLabel()
->columnSpan(1)
->extraAttributes(['class' => 'form-input']),
MoneyInput::make('value')
->translateLabel()
->columnSpan(1)
->extraAttributes(['class' => 'form-input']),
FileUpload::make('photo')
->imageEditor()
->image()
->translateLabel()
->columnSpan(1),
Actions::make([
Action::make('save')
->icon('heroicon-o-archive-box-arrow-down')
->color('success')
->action(function ($state) {
//new instance of paymentService based in fixed_order_id of select
$paymentService = new PaymentService(
FixedOrder::find($this->data['fixed_order_id'])->payment
);
//create a paid amount and return a instance of it service
PaidAmountService::create(
data: $state,
payment: $paymentService
);
})
])->verticalAlignment(VerticalAlignment::End),
Toggle::make('is_approved')
->translateLabel()
->columnSpan(1)
->extraAttributes(['class' => 'form-toggle']),
])
])
All fields are updated except the photo, could anyone tell me why?
No description
No description
16 Replies
awcodes
awcodes3mo ago
Make sure photo is fillable on the model.
Daniel
Daniel3mo ago
Sorry for the delay, my model has the photo as fillable, the photo appears in the strage public
awcodes
awcodes3mo ago
Are there any console errors in dev tools for the image?
Daniel
Daniel3mo ago
this is my console. for some reason the photo field needs to be an array to not give this error
No description
awcodes
awcodes3mo ago
Ok. FileUpload is always an array since it could be multiple. But you’re getting a 500. That will need more information for to help with. Anything in the laravel log? Seems like a server issues and not a filament issue though. But maybe we can figure it out.
Daniel
Daniel3mo ago
i understood
Daniel
Daniel3mo ago
No description
awcodes
awcodes3mo ago
Thank you but this doesn’t help. A stacktrace starting on line 52 is skipping a lot of relevant code and also isn’t a dev tools error.
Daniel
Daniel3mo ago
I did it with an image from the web and it didn't work
No description
Daniel
Daniel3mo ago
these are the last 100 lines of my log
Daniel
Daniel3mo ago
the console does not show errors
No description
Daniel
Daniel3mo ago
this is my record in the database
No description
awcodes
awcodes3mo ago
What does imagr have to do with filament? Just feel like there’s a lot of missing information here that makes it more difficult for any of isn’t it help.
Daniel
Daniel3mo ago
I understand, could you tell me if the filament FileUpload is capable of receiving a $set('name of repeater', ['photo' => 'image link']), and as soon as the set is executed it places the photo in the inside FileUpload?
awcodes
awcodes3mo ago
It’s entirely capable. You just have to understand that the FileUpload field expects an array and is also dependent on the storage facade of laravel.
Daniel
Daniel3mo ago
OK, thank you very much for your help, I'll try my best to see what's going on
Want results from more Discord servers?
Add your server