You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Laravel 10 / nova 4.27 app I added "anaseqal/nova-import": "^0.0.6"
and I defined app/Nova/Actions/ImportProducts.php actions :
<?php
namespace App\Nova\Actions;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Collection;
//use Laravel\Nova\Actions\Action;
use Anaseqal\NovaImport\Actions\Action; // I DECLARE THESE 2 FILES
use Anaseqal\NovaImport\NovaImport;
use Laravel\Nova\Fields\ActionFields;
use Laravel\Nova\Fields\File;
use Laravel\Nova\Http\Requests\NovaRequest;
use Maatwebsite\Excel\Excel;
class ImportProducts extends Action
{
use InteractsWithQueue, Queueable;
public function name()
{
return __('Import products from xls file');
}
public function handle(ActionFields $fields, Collection $models)
{
Excel::import(new \App\Imports\ImportProducts, $fields->file);
}
public function fields(NovaRequest $request)
{
return [
File::make('File')
->rules('required'),
];
}
}
I got error :
[2024-11-22 13:54:10] local.ERROR: Declaration of App\Nova\Actions\ImportProducts::fields(Laravel\Nova\Http\Requests\NovaRequest $request) must be compatible with Anaseqal\NovaImport\Actions\Action::fields() {"userId":1,"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Declaration of App\\Nova\\Actions\\ImportProducts::fields(Laravel\\Nova\\Http\\Requests\\NovaRequest $request) must be compatible with Anaseqal\\NovaImport\\Actions\\Action::fields() at /mnt/_work_sdb8/wwwroot/lar/NovaProducts/app/Nova/Actions/ImportProducts.php:46)
[stacktrace]
#0 /mnt/_work_sdb8/wwwroot/lar/NovaProducts/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(244): Symfony\\Component\\ErrorHandler\\Error\\FatalError->__construct(message: '...', code: '...', error: '...', traceOffset: '...', traceArgs: '...', trace: '...')
#1 /mnt/_work_sdb8/wwwroot/lar/NovaProducts/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(231): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->fatalErrorFromPhpError(error: '...', traceOffset: '...')
#2 /mnt/_work_sdb8/wwwroot/lar/NovaProducts/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(255): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleShutdown()
#3 /mnt/_work_sdb8/wwwroot/lar/NovaProducts/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(0): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure:/mnt/_work_sdb8/wwwroot/lar/NovaProducts/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:254-256}()
#4 {main}
"}
How it can be fixed ?
The text was updated successfully, but these errors were encountered:
In Laravel 10 / nova 4.27 app I added "anaseqal/nova-import": "^0.0.6"
and I defined app/Nova/Actions/ImportProducts.php actions :
I got error :
How it can be fixed ?
The text was updated successfully, but these errors were encountered: