Integrating NovaFileArtisan (Larupload) with Image Resource

Since v6.1.0

To enhance your Nova application's image handling capabilities, you can seamlessly integrate NovaFileArtisan, a feature-rich file uploader package that serves as a wrapper for Larupload. Follow these steps to incorporate NovaFileArtisan into your Image Resource:

  1. Install NovaFileArtisan and Larupload packages:

composer require mostafaznv/nova-file-artisan
  1. Modify your images table schema:

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;


return new class extends Migration
{
    public function up(): void
    {
        Schema::create('images', function (Blueprint $table) {
            $table->id();
            $table->string('name')->index();
            $table->upload('file');
            $table->timestamps();
        });
    }


    public function down(): void
    {
        Schema::drop('images');
    }
};
  1. Apply the Larupload trait to your Image model:

  1. Replace ImageUpload with NovaFileArtisan field in your Nova resource:

  1. You're Done!

These steps empower your Nova application with advanced file handling capabilities using NovaFileArtisan. Feel free to explore additional features and customization options offered by Larupload and NovaFileArtisan.

Last updated