I have this situation in laravel 5.2 where if I do this:
DB_CONNECTION=sqlite
DB_HOST=127.0.0.1
DB_PORT=
DB_DATABASE=database/database.sqlite
DB_USERNAME=
DB_PASSWORD=
in the .env file I get this:
InvalidArgumentException in SQLiteConnector.php line 34: Database (database/database.sqlite) does not exist.
on trying to manipulate the laravel error rendering system with this code from a controller:
<?php
namespace App\Http\Controllers;
use App\User;
class SampleController extends Controller
{
public function findUser()
{
$user = User::firstOrFail();
return $user->toArray();
}
}
And this goes well with php artisan migrate command, but to get the controller code to render the error as expected I have to do this:
DB_CONNECTION=sqlite
DB_HOST=127.0.0.1
DB_PORT=
DB_DATABASE=../database/database.sqlite
DB_USERNAME=
DB_PASSWORD=
To fix the problem so I get both php artisan migrate and SampleController to work I have put this in the config/database.php file:
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => database_path('database.sqlite'),
'prefix' => '',
],
Why is the default means to access sqlite as given on the laravel website not working. Is it a bug I should be aware of?
config.phpfile is normally expected to contain'database' => env('DB_DATABASE', database_path('database.sqlite')),in it's'sqlite'array.