PHP code example of simonhamp / laravel-nova-csv-import

1. Go to this page and download the library: Download simonhamp/laravel-nova-csv-import 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/ */

    

simonhamp / laravel-nova-csv-import example snippets


namespace App\Providers;

use SimonHamp\LaravelNovaCsvImport\LaravelNovaCsvImport;

class NovaServiceProvider extends NovaApplicationServiceProvider
{
    public function tools()
    {
        return [
            new LaravelNovaCsvImport,
        ];
    }
}

public function boot()
{
    parent::boot();

    Nova::mainMenu(function (Request $request) {
        return [
            // ... other custom menu items

            MenuSection::make('CSV Import')
                ->path('/csv-import')
                ->icon('upload'),
        ];
    }
}

// App\Nova\User
public static function canImportResource(Request $request)
{
    return $request->user()->can("create", self::$model);
}

public static function excludeAttributesFromImport()
{
    return ['password'];
}



return [
    'importer' =>  App\Utilities\Importer::class,
];