Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

from one of my controllers. I am using laravel 5.6 and i have followed the documentation strictly and other very few related discussions online to solve this, but i still get the error.

How do i solve this error please

app.php

'provider' => 'Maatwebsite\Excel\ExcelServiceProvider',
'alias' => 'Excel'=>  'Maatwebsite\Excel\Facades\Excel',

Controller

$cl = ClassModel::Select('name')->where('code',$input->class)->first();
        $input->class=$cl->name;
        $fileName=$input->class.'-'.$input->section.'-'.$input->session.'-'.$input->exam;
        // return $students;
        Excel::create($fileName, function($excel) use($input,$subjects,$students) {
            $excel->sheet('New sheet', function($sheet) use ($input,$subjects,$students) {
                $sheet->loadView('app.excel',compact('subjects','input','students'));
        })->download('xlsx');
                Version 3.0 of that package doesn't handle imports yet. Release date for this feature is unknown. See this post for more details: medium.com/@maatwebsite/…
– AddWeb Solution Pvt Ltd
                May 18, 2018 at 10:45
                Per documentation: "Excel::create() is removed and replaced by Excel::download/Excel::store($yourExport)"
– cfnerd
                Sep 11, 2018 at 21:37
                [InvalidArgumentException]                                                      Could not find package ~2.1.0 at any version for your minimum-stability (de     v). Check the package spelling or your minimum-stability
– user9653376
                May 18, 2018 at 10:57

There have been many changes in the new version of the package.

In your composer.json file inside the require array replace your package with this:

"maatwebsite/excel": "~2.1.0",

and then run composer update This should work fine.

Definitely good, but the intention was not to update all dependencies. Anyway since its still in development, there might not be worries. Otherwise, I'll safely install the dependency individually. Or rather, remove my vendor folder and rerun composer install – Oluwatobi Samuel Omisakin May 18, 2018 at 10:44 'good' practice could be relative, the vendor folder changes anyways through out the development changes. So yes, if there's a need to remove 'vendor' folder one can do so, simply running composer install would generate back the vendor folder based on the specification in the composer.lock or composer.json file(s) – Oluwatobi Samuel Omisakin May 18, 2018 at 11:05 When i switch to version 2, i get this error in the terminal Conclusion: remove laravel/framework v5.6.7 – user9653376 May 18, 2018 at 10:53

I have worked it around but I know it's not a perfect solution. It will really help you if you only have concerns with the uploading not adjusting Crudbooster features.

  • I removed the extra features from the importing screen of the Crudbooster by applying the following CSS in the crudbooster-controller.

         $this->style_css = "ul.nav li:not(:first-child) {
             display: none;
    
  • I copied the getImportData() method from Crudbooster CBController and overridden it in the crudbooster-controller by the following code.

    //By the way, you can still create your own method in here... :) public function getImportData() $this->cbLoader(); $data['page_menu'] = Route::getCurrentRoute()->getActionName(); $data['page_title'] = 'Import Data'; if (request('file') && ! request('import')) { $file = base64_decode(request('file')); $file = storage_path('app/'.$file); $data = Excel::import(new ProductImport, $file); CRUDBooster::redirect('/admin/products', cbLang("alert_add_data_success"), 'success'); return view('crudbooster::import', $data);

    Importing is working fine now

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.

  •