Search code examples
phplaravellaravel-backpack

Images are not displayed on the site after they are sent through the database Laravel Backpack


I encountered a problem that after uploading a photo to the site through the admin panel, the photo appears in the database but does not appear in the public folder for display on the site. I did not change the filesystem.php after the backpack installation. The only changes were in this file, where the interactions are written

InstagramPostsCrudController.php

protected function setupCreateOperation()
    {
        CRUD::setValidation(InstagramPostsRequest::class);
        CRUD::setFromDb();
        CRUD::field('photo')->type('upload');
    }

Solution

  • as our docs says, please try with

    CRUD::field('photo')->type('upload')->withFiles(true);
    

    Make sure you have correctly set the public symlink too

    php artisan storage:link
    

    Cheers.