Laravel Community Tools by Tighten
Laravel Nova icon Nova Packages

Installation Instructions

you can install it by composer

composer require halimtuhu/array-images

after installation complete, you ready to go.

Readme

Laravel Nova Field - Array Images

A laravel nova field that will let you save your uploaded images path to your database in array format.

Installation

composer require halimtuhu/array-images

Usage

Create array images just call Halimtuhu\ArrayImages\ArrayImages class and use make static method to create a field.

...
use Halimtuhu\ArrayImages\ArrayImages;
...
public function fields(Request $request)
    {
        return [
            ...
            ArrayImages::make('Images', 'images'),
            ...
        ];
    }
...

That will create a field with name Images. Stored data will look like this.

[{
    "url": "http://laranov.halimtuhu.test/storage/wB04AbprHGxHw4I3sizXmuw9L4LBcG0wv0QEacAo.jpeg",
    "name": "wB04AbprHGxHw4I3sizXmuw9L4LBcG0wv0QEacAo.jpeg"
}, {
    "url": "http://laranov.halimtuhu.test/storage/eOuxUCjHGNokkHdOXYB7gGObxCvf7m30ridFpBpy.jpeg",
    "name": "eOuxUCjHGNokkHdOXYB7gGObxCvf7m30ridFpBpy.jpeg"
}, {
    "url": "http://laranov.halimtuhu.test/storage/nLkZp4vfpATEp56NStJfeAtKoHvmN2hapfxoNrEN.jpeg",
    "name": "nLkZp4vfpATEp56NStJfeAtKoHvmN2hapfxoNrEN.jpeg"
}]

Available Methods

Disk

Specify disk target for uploaded images.

ArrayImages::make('Images', 'images')
    ->disk('public'),

If not specified then the default disk will be used.

Path

Specify target path for uploaded images.

ArrayImages::make('Images', 'images)
    ->disk('public')
    ->path('images'),

If not specified then default path on selected disk will be used.

Notes

  • make sure you have specified correct APP_URL on your application
  • make sure you have specified default FILESYSTEM_DRIVER on your application

Screenshots

Reviews

By Jesus Franco on August 11, 2021

Thank you for the idea behind this package and its initial implementation, it kinda works. However there are 2 important issues with the current release: 1. The returned URL does not returns actually the uploaded image. In your master branch it is fixed by a contributor, however it is not released as a new tag, distributing thus the broken package through packagist. 2. The delete method also does not work, and it required patching both the Vue component as well the controller. I've sent a PR fixing this last method, and with the release of your previous accepted PR as a new stable release it could work at least. Maybe you and people that found these issues, would like the patched version: https://github.com/halimtuhu/array-images/issues/10#issuecomment-896477803

By Jeremias Araujo on October 26, 2020

Very easy to implement

By ahmedalkhairy on October 6, 2020

very helpful

By Сергей Демиденко on February 10, 2020

All work normal.

Back to Top
Added 7 years ago
Last updated 7 Years Ago
Version 1.1
Composer
halimtuhu/array-images
GitHub stars 14
Packagist downloads 39,689

Favorites

9 users favorited

Rating

4.30
(out of 5)
★★★★★
★★★★
★★★
★★
7 ratings

Contributors

Brought to you by Tighten

Issues/Feature Requests Stats Package Ideas