Skip to content

Commit

Permalink
Merge commit 'refs/pull/948/head' of github.com:jenssegers/laravel-mo…
Browse files Browse the repository at this point in the history
…ngodb

* github.com:jenssegers/laravel-mongodb:
  styleci
  Remove dependency on Laravel Application
  • Loading branch information
pi0 committed Sep 11, 2016
2 parents 6d52a0b + b399fcf commit a00021c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Moloquent/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,21 @@ public function __construct(Connection $connection, Processor $processor)
$this->grammar = new Grammar;
$this->connection = $connection;
$this->processor = $processor;
$this->useCollections = version_compare(\Illuminate\Foundation\Application::VERSION, '5.3', '>=');
$this->useCollections = $this->shouldUseCollections();
}

/**
* Returns true if Laravel or Lumen >= 5.3
*
* @return bool
*/
protected function shouldUseCollections()
{
if (function_exists('app')) {
$version = app()->version();
$version = filter_var(explode(')', $version)[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); // lumen
return version_compare($version, '5.3', '>=');
}
}

/**
Expand Down

0 comments on commit a00021c

Please sign in to comment.