F
Filament4mo 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
awcodes4mo ago
Make sure photo is fillable on the model.
Daniel
DanielOP4mo ago
Sorry for the delay, my model has the photo as fillable, the photo appears in the strage public
awcodes
awcodes4mo ago
Are there any console errors in dev tools for the image?
Daniel
DanielOP4mo ago
this is my console. for some reason the photo field needs to be an array to not give this error
No description
awcodes
awcodes4mo 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
DanielOP4mo ago
i understood
Daniel
DanielOP4mo ago
No description
awcodes
awcodes4mo 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
DanielOP4mo ago
I did it with an image from the web and it didn't work
No description
Daniel
DanielOP4mo ago
these are the last 100 lines of my log
Daniel
DanielOP4mo ago
the console does not show errors
No description
Daniel
DanielOP4mo ago
this is my record in the database
No description
awcodes
awcodes4mo 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
DanielOP4mo 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
awcodes4mo 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
DanielOP4mo 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