1

私はphp7.0でLaravel 5.2を使用しています。

Laravel Excel ( http://www.maatwebsite.nl/laravel-excel ) を使用しようとしています。このような:

public function export(){
    $users = User::with('roles')->get();

    $excel = Excel::create('beo_felhasznalo_export'. date('_Y-m-d_H-i-s'));

    //header
    $excel->appendRow(array(
        'felhasználónév', 'valódi név', 'e-mail', 'mobil', 'felhasználói szint'
    ));

    foreach($users as $user){
        $excel->appendRow(array(
            $user->username,
            $user->real_name,
            $user->email,
            $user->mobile_number,
            implode(',', $user->roles())
        ));
    }
    $excel->download('xls');
}

次のエラーが表示されます。

Illuminate\Contracts\Container\BindingResolutionException thrown with message "Target [Illuminate\Contracts\Bus\Dispatcher] is not instantiable."

Stacktrace:
#87 Illuminate\Contracts\Container\BindingResolutionException in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Container\Container.php:752
#86 Illuminate\Container\Container:build in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Container\Container.php:633
#85 Illuminate\Container\Container:make in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:674
#84 Illuminate\Foundation\Application:make in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Container\Container.php:1178
#83 Illuminate\Container\Container:offsetGet in D:\Projects\beo_site\vendor\maatwebsite\excel\src\Maatwebsite\Excel\ExcelServiceProvider.php:123
#82 Maatwebsite\Excel\ExcelServiceProvider:Maatwebsite\Excel\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Container\Container.php:289
#81 Illuminate\Container\Container:Illuminate\Container\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Container\Container.php:735
#80 Illuminate\Container\Container:build in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Container\Container.php:633
#79 Illuminate\Container\Container:make in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:674
#78 Illuminate\Foundation\Application:make in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Container\Container.php:1178
#77 Illuminate\Container\Container:offsetGet in D:\Projects\beo_site\vendor\maatwebsite\excel\src\Maatwebsite\Excel\ExcelServiceProvider.php:179
#76 Maatwebsite\Excel\ExcelServiceProvider:Maatwebsite\Excel\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Container\Container.php:289
#75 Illuminate\Container\Container:Illuminate\Container\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Container\Container.php:735
#74 Illuminate\Container\Container:build in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Container\Container.php:633
#73 Illuminate\Container\Container:make in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:674
#72 Illuminate\Foundation\Application:make in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Container\Container.php:1178
#71 Illuminate\Container\Container:offsetGet in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:151
#70 Illuminate\Support\Facades\Facade:resolveFacadeInstance in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:120
#69 Illuminate\Support\Facades\Facade:getFacadeRoot in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:207
#68 Illuminate\Support\Facades\Facade:__callStatic in D:\Projects\beo_site\app\Http\Controllers\UserController.php:196
#67 App\Http\Controllers\UserController:export in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Controller.php:78
#66 call_user_func_array in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Controller.php:78
#65 Illuminate\Routing\Controller:callAction in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php:146
#64 Illuminate\Routing\ControllerDispatcher:call in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php:94
#63 Illuminate\Routing\ControllerDispatcher:Illuminate\Routing\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:52
#62 call_user_func in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:52
#61 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:102
#60 call_user_func in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:102
#59 Illuminate\Pipeline\Pipeline:then in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php:96
#58 Illuminate\Routing\ControllerDispatcher:callWithinStack in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php:54
#57 Illuminate\Routing\ControllerDispatcher:dispatch in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Route.php:174
#56 Illuminate\Routing\Route:runController in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Route.php:140
#55 Illuminate\Routing\Route:run in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Router.php:724
#54 Illuminate\Routing\Router:Illuminate\Routing\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:52
#53 call_user_func in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:52
#52 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in D:\Projects\beo_site\app\Http\Middleware\Authenticate.php:28
#51 App\Http\Middleware\Authenticate:handle in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#50 call_user_func_array in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#49 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#48 call_user_func in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#47 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php:64
#46 Illuminate\Foundation\Http\Middleware\VerifyCsrfToken:handle in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#45 call_user_func_array in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#44 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#43 call_user_func in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#42 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php:49
#41 Illuminate\View\Middleware\ShareErrorsFromSession:handle in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#40 call_user_func_array in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#39 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#38 call_user_func in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#37 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php:62
#36 Illuminate\Session\Middleware\StartSession:handle in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#35 call_user_func_array in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#34 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#33 call_user_func in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#32 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php:37
#31 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse:handle in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#30 call_user_func_array in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#29 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#28 call_user_func in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#27 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php:59
#26 Illuminate\Cookie\Middleware\EncryptCookies:handle in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#25 call_user_func_array in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#24 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#23 call_user_func in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#22 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:102
#21 call_user_func in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:102
#20 Illuminate\Pipeline\Pipeline:then in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Router.php:726
#19 Illuminate\Routing\Router:runRouteWithinStack in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Router.php:699
#18 Illuminate\Routing\Router:dispatchToRoute in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Router.php:675
#17 Illuminate\Routing\Router:dispatch in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:246
#16 Illuminate\Foundation\Http\Kernel:Illuminate\Foundation\Http\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:52
#15 call_user_func in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:52
#14 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in D:\Projects\beo_site\vendor\barryvdh\laravel-debugbar\src\Middleware\Debugbar.php:49
#13 Barryvdh\Debugbar\Middleware\Debugbar:handle in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#12 call_user_func_array in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#11 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#10 call_user_func in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#9 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php:44
#8 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode:handle in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#7 call_user_func_array in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:124
#6 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#5 call_user_func in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32
#4 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:102
#3 call_user_func in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:102
#2 Illuminate\Pipeline\Pipeline:then in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:132
#1 Illuminate\Foundation\Http\Kernel:sendRequestThroughRouter in D:\Projects\beo_site\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:99
#0 Illuminate\Foundation\Http\Kernel:handle in D:\Projects\beo_site\public\index.php:53

プロバイダー配列に Maatwebsite\Excel\ExcelServiceProvider::class を追加し、エイリアス配列に 'Excel' => Maatwebsite\Excel\Facades\Excel::class を追加しました。

私は何かを逃しましたか?

4

2 に答える 2

6

解決策を見つけました!

Laravel 5.2 では、コマンド バスがフレームワークから削除されました。ここから手動でインストールする必要があります: https://laravelcollective.com/docs/5.2/bus

LaraveExcel プロジェクトの readme にプル リクエストを発行しました: https://github.com/Maatwebsite/Laravel-Excel/pull/727/files

于 2016-03-16T14:11:15.377 に答える
2

Laravel 5.3 を使用する場合は、 https://github.com/AltThree/Busを使用してください

「Laravel 5.2+ 用の改善されたコマンド バス。現在のリリースは Laravel 5.3 用ですが、以前のシリーズは 5.2 または 5.3.0-RC1 以前用でした。」

LC が 5.3 で機能しない

于 2016-11-20T23:49:34.470 に答える