Skip to content

Remove dependency on Laravel Application #948

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Oct 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/Jenssegers/Mongodb/Query/Builder.php
Original file line number Diff line number Diff line change
@@ -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', '>=');
}
}

/**