orchidsoftware / platform

Orchid is a @laravel package that allows for rapid application development of back-office applications, admin/user panels, and dashboards.
https://orchid.software
MIT License
4.4k stars 646 forks source link

Can not get attachments to display when editing #2638

Closed AlizHarb closed 1 year ago

AlizHarb commented 1 year ago

Hello I'm using upload for images with the relation, everything works fine until i want to edit. Images not being display back under the upload input

here is my query

public function query(City $city): iterable
    {
        $city->load('attachment');

        return [
            'city' => $city,
        ];
    }
tabuna commented 1 year ago

There is too little information to be able to reproduce the error you encountered.

AlizHarb commented 1 year ago

I'm using Attachable trait and relation for uploading images, everything works very well but i can not get the images to display when i want to edit the city image

tabuna commented 1 year ago

Name of the Upload::make('attachment') field?

AlizHarb commented 1 year ago

Name of the Upload::make('attachment') field?

Upload::make('city.image')
                            ->title('City Image')
                            ->maxFiles(1)
                            ->groups('cities')
                            ->acceptedFiles('image/*')
                            ->media(),
tabuna commented 1 year ago

The naming should match what is stored with the model:

Input::name('city.name') 
// value equivalent to 
$city->name

You can learn more at https://orchid.software/en/docs/screens/

AlizHarb commented 1 year ago

The naming should match what is stored with the model:

Input::name('city.name') 
// value equivalent to 
$city->name

You can learn more at https://orchid.software/en/docs/screens/

ok i got that point, as you see in the screenshot that all inputs returned the values, i just want to return the images as well, i have tried to use attachment like that

Upload::make('attachment')

but did not work :(

tabuna commented 1 year ago

We have the key of the city.*

Upload::make('city.attachment')
AlizHarb commented 1 year ago

We have the key of the city.*

Upload::make('city.attachment')

Thank you, now it works but the image is not displaying but it exists in the directory, also the media is empty image