PHP code example of weiwait / nova-images

1. Go to this page and download the library: Download weiwait/nova-images library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

weiwait / nova-images example snippets


// In Model
public $cast = [
    'images' => 'array',
];

// In Migration
public function up()
{
    Schema::create('users', function (Blueprint $table) {
        $table->json('images')->nullable()->comment('多图');
    });
}

// In Nova resource
public function fields(Request $request)
{
    return [      
        \Weiwait\NovaImages\Images::make('图片', 'images')
            ->cropper([
                'autoCrop' => true,
                'fixed' => true,
                'fixedNumber' => [16, 9],
                'enlarge' => 3,
            ]),
    ];
}