diff --git a/laravel/config/container.php b/laravel/config/container.php index e4de06d0..72dbc35e 100644 --- a/laravel/config/container.php +++ b/laravel/config/container.php @@ -53,7 +53,7 @@ 'laravel.database.connectors.sqlite' => array('resolver' => function($c) { - return new Database\Connectors\SQLite; + return new Database\Connectors\SQLite(DATABASE_PATH); }), 'laravel.database.connectors.mysql' => array('resolver' => function($c) diff --git a/laravel/database/connectors/sqlite.php b/laravel/database/connectors/sqlite.php index aeb6e972..ab67f52b 100644 --- a/laravel/database/connectors/sqlite.php +++ b/laravel/database/connectors/sqlite.php @@ -2,6 +2,24 @@ class SQLite extends Connector { + /** + * The path to the SQLite databases for the application. + * + * @var string + */ + protected $path; + + /** + * Create a new SQLite database connector instance. + * + * @param string $path + * @return void + */ + public function __construct($path) + { + $this->path = $path; + } + /** * Establish a PDO database connection for a given database configuration. * @@ -21,7 +39,7 @@ public function connect($config) // application. If we don't find the database there, we will assume the database // name is actually a full qualified path to the database on disk and attempt // to load it. If we still can't find it, we'll bail out. - elseif (file_exists($path = DATABASE_PATH.$config['database'].'.sqlite')) + elseif (file_exists($path = $this->path.$config['database'].'.sqlite')) { return new PDO('sqlite:'.$path, null, null, $options); }