classes/Models/Traits/HasImages.php
public function croppedImages($width = null, $height = null, $options = null)
    {
        return array_combine(

            // Keys
            $this->images->map(function ($image) {
                return $image->name ?: 'default';
            })->toArray(),

            // Values
            $this->images->map(function ($image) use ($width, $height, $options) {
                return $image->crop($width, $height, $options)->url;
            })->toArray()
        );
    }
public function croppedImages($width = null, $height = null, $options = null)
    {
        return array_combine(

            // Keys
            $this->images->map(function ($image) {
                return $image->name ?: 'default';
            })->toArray(),

            // Values
            $this->images->map(function ($image) use ($width, $height, $options) {
                return $image->crop($width, $height, $options)->url;
            })->toArray()
        );
    }
public function croppedImages ( $ width = null , $ height = null , $ options = null ) { return array_combine ( // Keys $ this -> images -> map ( function ( $ image ) { return $ image -> name ? : 'default' ; } ) -> toArray ( ) , // Values $ this -> images -> map ( function ( $ image ) use ( $ width , $ height , $ options ) { return $ image -> crop ( $ width , $ height , $ options ) -> url ; } ) -> toArray ( ) ) ; }
Return an array of all images associated with the model, keyed by their
name, while optionally applying a crop to them
Return an array of all images associated with the model keyed by their name while optionally applying a crop to them