Commit e61ca72f authored by Craig Morris's avatar Craig Morris Committed by Jens Segers

Remove dependency on Laravel Application (#948)

* Remove dependency on Laravel Application

* styleci
parent c64dc03a
......@@ -103,7 +103,21 @@ class Builder extends BaseBuilder
$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', '>=');
}
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment