Skip to content

Commit

Permalink
Fixed issue with facade binding - closes #32
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Gwerder committed Feb 8, 2017
1 parent eeac90d commit 02fd69b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/ApiHandlerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ public function boot()
*/
public function register()
{
$this->app['ApiHandler'] = $this->app->singleton('Marcelgwerder\ApiHandler', function ($app) {
return new ApiHandler;
});
$this->app->bind('ApiHandler', 'Marcelgwerder\ApiHandler\ApiHandler');
}
}
4 changes: 1 addition & 3 deletions src/CountMetaProvider.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php namespace Marcelgwerder\ApiHandler;

use Illuminate\Support\Facades\DB;

class CountMetaProvider extends MetaProvider
{
/**
Expand Down Expand Up @@ -37,7 +35,7 @@ public function get()
$this->builder->limit = null;

//Use the original builder as a subquery and count over it because counts over groups return the number of rows for each group, not for the total results
$query = DB::query()->selectRaw('count(*) as aggregate from (' . $this->builder->toSql() . ') as count_table', $this->builder->getBindings());
$query = $this->builder->newQuery()->selectRaw('count(*) as aggregate from (' . $this->builder->toSql() . ') as count_table', $this->builder->getBindings());
return intval($query->first()->aggregate);
}

Expand Down

0 comments on commit 02fd69b

Please sign in to comment.