I'm creating a small mockup for a social network in Laravel 5. I want to use SQLite as my database to keep things small and local. I'm having some trouble, however, getting it to work.
Here's my code (using blade) where I just use a table to display a row in the database:
@extends('layouts.master')
@section('title')
Testing2
@stop
@section('content')
This is a second test
<a href="/">Back to page 1</a>
<table>
<tr><th>Author</th>
<th>Text</th></tr>
@foreach($posts as $post)
<tr>
<td>
{{$posts->Author}}
</td>
</tr>
<tr>
<td>
{{$posts->Text}}
</td>
</tr>
@endforeach
</table>
@stop
"Author" and "Text" being 2 columns in my database. Here is the Route I use to generate the page:
Route::get('test2', function () {
$sql = "select * from Posts";
$posts = DB::select($sql);
return View::make('test2')->withPosts($posts);
});
I know my database is there, I've placed it in the /database directory of my app:
Lastly, I modified the config\database.php file to set SQLite as the default database:
When I try and view the blade page using the Route function, I get the following error: "SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it."
I'm doing something wrong somewhere with connecting to my database, but I don't know what. Have I set it up properly?


.envfile look like? It is looking inside your.envfile first for yourDB_CONNECTIONand then if that doesn't exist it will use thesqlitedefinition you have set.