I am working in a laravel 5 application and I am trying to debug the database queries that are running in the background.
So I tried the way that many people in the community try:
http://ift.tt/1LRNTL9
But to my surprise I am getting back a weird exception thrown by laravel saying:
Missing argument 2 for App\Providers\AppServiceProvider::App\Providers{closure}()
[2016-03-01 07:12:18] local.ERROR: exception 'ErrorException' with message 'Missing argument 2 for App\Providers\AppServiceProvider::App\Providers\{closure}()' in /home/vagrant/Code/tenant-application/app/Providers/AppServiceProvider.php:19
Stack trace:
#0 /home/vagrant/Code/tenant-application/app/Providers/AppServiceProvider.php(19): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'Missing argumen...', '/home/vagrant/C...', 19, Array)
#1 [internal function]: App\Providers\AppServiceProvider->App\Providers\{closure}(Object(Illuminate\Database\Events\QueryExecuted))
#2 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(221): call_user_func_array(Object(Closure), Array)
#3 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Database/Connection.php(750): Illuminate\Events\Dispatcher->fire(Object(Illuminate\Database\Events\QueryExecuted))
#4 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Database/Connection.php(641): Illuminate\Database\Connection->logQuery('select * from `...', Array, 1.26)
#5 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Database/Connection.php(342): Illuminate\Database\Connection->run('select * from `...', Array, Object(Closure))
#6 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1461): Illuminate\Database\Connection->select('select * from `...', Array, true)
#7 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1447): Illuminate\Database\Query\Builder->runSelect()
#8 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(569): Illuminate\Database\Query\Builder->get(Array)
#9 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(303): Illuminate\Database\Eloquent\Builder->getModels(Array)
#10 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(273): Illuminate\Database\Eloquent\Builder->get(Array)
#11 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php(100): Illuminate\Database\Eloquent\Builder->first()
#12 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php(353): Illuminate\Auth\EloquentUserProvider->retrieveByCredentials(Array)
#13 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php(256): Illuminate\Auth\SessionGuard->attempt(Array, false, false)
#14 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Auth/SessionGuard.php(239): Illuminate\Auth\SessionGuard->validate(Array)
#15 [internal function]: Illuminate\Auth\SessionGuard->once(Array)
#16 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php(282): call_user_func_array(Array, Array)
#17 /home/vagrant/Code/tenant-application/vendor/tymon/jwt-auth/src/Providers/Auth/IlluminateAuthAdapter.php(39): Illuminate\Auth\AuthManager->__call('once', Array)
#18 /home/vagrant/Code/tenant-application/vendor/tymon/jwt-auth/src/Providers/Auth/IlluminateAuthAdapter.php(39): Illuminate\Auth\AuthManager->once(Array)
#19 /home/vagrant/Code/tenant-application/vendor/tymon/jwt-auth/src/JWTAuth.php(108): Tymon\JWTAuth\Providers\Auth\IlluminateAuthAdapter->byCredentials(Array)
#20 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(221): Tymon\JWTAuth\JWTAuth->attempt(Array, Array)
#21 /home/vagrant/Code/tenant-application/vendor/archiveonline/tenant-package/src/Controllers/Auth/AuthController.php(43): Illuminate\Support\Facades\Facade::__callStatic('attempt', Array)
#22 /home/vagrant/Code/tenant-application/vendor/archiveonline/tenant-package/src/Controllers/Auth/AuthController.php(43): Tymon\JWTAuth\Facades\JWTAuth::attempt(Array, Array)
#23 [internal function]: Uppdragshuset\AO\Tenant\Controllers\Auth\AuthController->authenticate()
#24 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(78): call_user_func_array(Array, Array)
#25 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(146): Illuminate\Routing\Controller->callAction('authenticate', Array)
#26 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(94): Illuminate\Routing\ControllerDispatcher->call(Object(Uppdragshuset\AO\Tenant\Controllers\Auth\AuthController), Object(Illuminate\Routing\Route), 'authenticate')
#27 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#28 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#29 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#30 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#31 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(96): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#32 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(54): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(Uppdragshuset\AO\Tenant\Controllers\Auth\AuthController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'authenticate')
#33 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/Route.php(174): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'Uppdragshuset\\A...', 'authenticate')
#34 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/Route.php(140): Illuminate\Routing\Route->runController(Object(Illuminate\Http\Request))
#35 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/Router.php(724): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#36 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#37 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#38 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#39 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#40 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/Router.php(726): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#41 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/Router.php(699): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#42 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/Router.php(675): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#43 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(246): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#44 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#45 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#46 /home/vagrant/Code/tenant-application/vendor/archiveonline/tenant-package/src/Middleware/Cors.php(25): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#47 [internal function]: Uppdragshuset\AO\Tenant\Middleware\Cors->handle(Object(Illuminate\Http\Request), Object(Closure))
#48 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#49 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#50 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#51 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(44): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#52 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#53 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#54 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#55 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#56 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#57 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#58 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#59 /home/vagrant/Code/tenant-application/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(99): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#60 /home/vagrant/Code/tenant-application/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#61 {main}
That is the trace but I cannot figure out what I am doing wrong here.
AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use DB;
use Log;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
DB::listen(function($sql, $bindings, $time) {
Log::info($time . "\r\n" . $sql);
});
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}
via
Chebli Mohamed