charliefortune
charliefortune
FFilament
Created by charliefortune on 11/28/2023 in #❓┊help
Is it possible to remove headers from repeater rows?
Brilliant, just what I needed, thanks!
5 replies
FFilament
Created by charliefortune on 10/4/2023 in #❓┊help
What's the best way to store S3 image URI to work with the file upload field?
I don't understand why the driver wouldn't be able to find that file. Have I correctly understood what the 'directory' method is for?
22 replies
FFilament
Created by charliefortune on 10/4/2023 in #❓┊help
What's the best way to store S3 image URI to work with the file upload field?
and the bucket is correctly set in the filesystems.php config file?
22 replies
FFilament
Created by charliefortune on 10/4/2023 in #❓┊help
What's the best way to store S3 image URI to work with the file upload field?
to be able to draw the image (http://example.s3-website.eu-west-2.amazonaws.com/image/file/Screen_Shot_2019-03-20_at_11_57_05.png) on next visit, if the value in the
logo_path
logo_path
property is something like this
Screen_Shot_2019-03-20_at_11_57_05.png
Screen_Shot_2019-03-20_at_11_57_05.png
22 replies
FFilament
Created by charliefortune on 10/4/2023 in #❓┊help
What's the best way to store S3 image URI to work with the file upload field?
FileUpload::make('logo_path')
->label('Logo')
->disk('s3')
->directory('image/file')
->visibility('private')
->image();
FileUpload::make('logo_path')
->label('Logo')
->disk('s3')
->directory('image/file')
->visibility('private')
->image();
22 replies
FFilament
Created by charliefortune on 10/4/2023 in #❓┊help
What's the best way to store S3 image URI to work with the file upload field?
Would you expect a component defined like this
22 replies
FFilament
Created by charliefortune on 10/4/2023 in #❓┊help
What's the best way to store S3 image URI to work with the file upload field?
hmm, so my problem isn't related to the api trip, in that case. When the page loads, it has valid data in the file upload component, but it fails to render the image. Is there a way to debug this other than hacking into the component code?
22 replies
FFilament
Created by charliefortune on 10/4/2023 in #❓┊help
What's the best way to store S3 image URI to work with the file upload field?
so when you return to the form the next day, the image is rendered and visible.
22 replies
FFilament
Created by charliefortune on 10/4/2023 in #❓┊help
What's the best way to store S3 image URI to work with the file upload field?
but if this is set up with s3 as storage in a more normal way (without the api round trip), then the s3 driver would normally be able to render a thumbnail from an S3 path, wouldn't it? Am I right in assuming that's how it's meant to work?
22 replies
FFilament
Created by charliefortune on 10/4/2023 in #❓┊help
What's the best way to store S3 image URI to work with the file upload field?
there is a value in the
logo_path
logo_path
property of the record, I assumed this would be used to render the image when the form's reloaded.
22 replies
FFilament
Created by charliefortune on 10/4/2023 in #❓┊help
What's the best way to store S3 image URI to work with the file upload field?
my setup is a bit different, I don't write directly to the underlying model. I post to an API (via afterStateUpdated) then persist the record locally once it's been returned from the remote service. I do get the initial (local) preview after upload - but when I reload the form, there isn't a thumbnail.
22 replies
FFilament
Created by charliefortune on 10/4/2023 in #❓┊help
What's the best way to store S3 image URI to work with the file upload field?
and should I be saving the location as a full URL, or a file path relative to the bucket? I've tried both and can't get the preview to render on reload.
22 replies
FFilament
Created by charliefortune on 9/6/2023 in #❓┊help
How can I get the ID of the deleted item in a repeater action?
yeah cool, thanks for your help 👍
17 replies
FFilament
Created by charliefortune on 9/6/2023 in #❓┊help
How can I get the ID of the deleted item in a repeater action?
Is there an easy way to reload the collection from the underlying relationship? I could just refesh my repeater, you see.
17 replies
FFilament
Created by charliefortune on 9/6/2023 in #❓┊help
How can I get the ID of the deleted item in a repeater action?
I guess I will do this in a similar way - manipulate the collection.
17 replies
FFilament
Created by charliefortune on 9/6/2023 in #❓┊help
How can I get the ID of the deleted item in a repeater action?
a related issue is how to update the collection with the properties of the record once it has been persisted in the api and locally - I get a record back from the api and insert it locally. But in order to capture further updates to that repeater item, I need to add the new ID into the in-memory item.
17 replies
FFilament
Created by charliefortune on 9/6/2023 in #❓┊help
How can I get the ID of the deleted item in a repeater action?
I don't have any kind of form save - everything else saves on update events. I could compare the collection, but that seems a bit clunky. But if I can get the
$arguments
$arguments
into my closure then I should be able to get the item from there, I guess.
17 replies
FFilament
Created by charliefortune on 9/6/2023 in #❓┊help
How can I get the ID of the deleted item in a repeater action?
Once I've got a reference to the current item, I can do the rest
17 replies
FFilament
Created by charliefortune on 9/6/2023 in #❓┊help
How can I get the ID of the deleted item in a repeater action?
My architecture is client>api - so I need to do more than just kill the member of the collection in the local db. I want the ID so I can post the delete request back to the api, then I will remove the local record depending on the api response.
17 replies
FFilament
Created by charliefortune on 9/4/2023 in #❓┊help
How do I reload a repeater item after one of its fields have been updated?
Repeater::make('eventQuestionnaires')
->relationship()
->schema([
Select::make('questionnaire_id')
->options($this->event->clientAccount->questionnaires()->pluck('title', 'id'))
->afterStateUpdated(function (?EventQuestionnaire $record, Select $component, $state) {
if(!$record){
//Prepare data for INSERT
$data['questionnaire_id'] = $state;
$data['event_id'] = $this->event->id;
$state = $data;
}
$record = $this->upsert($record, $component->getName(), $state, 'EventQuestionnaire');
}),

Select::make('feedback_report_phase_id')
->options(FeedbackReportPhase::all()->sortBy('sort')->pluck('title', 'id'))
->lazy()
->afterStateUpdated(function (?EventQuestionnaire $record, Select $component, $state) {
if(!$record){
//Prepare data for INSERT
$data['feedback_report_phase_id'] = $state;
$data['event_id'] = $this->event->id;
$state = $data;
}
$record = $this->upsert($record, $component->getName(), $state, 'EventQuestionnaire');
}),
])
])
Repeater::make('eventQuestionnaires')
->relationship()
->schema([
Select::make('questionnaire_id')
->options($this->event->clientAccount->questionnaires()->pluck('title', 'id'))
->afterStateUpdated(function (?EventQuestionnaire $record, Select $component, $state) {
if(!$record){
//Prepare data for INSERT
$data['questionnaire_id'] = $state;
$data['event_id'] = $this->event->id;
$state = $data;
}
$record = $this->upsert($record, $component->getName(), $state, 'EventQuestionnaire');
}),

Select::make('feedback_report_phase_id')
->options(FeedbackReportPhase::all()->sortBy('sort')->pluck('title', 'id'))
->lazy()
->afterStateUpdated(function (?EventQuestionnaire $record, Select $component, $state) {
if(!$record){
//Prepare data for INSERT
$data['feedback_report_phase_id'] = $state;
$data['event_id'] = $this->event->id;
$state = $data;
}
$record = $this->upsert($record, $component->getName(), $state, 'EventQuestionnaire');
}),
])
])
4 replies