php - Setting SQLite as my database in laravel 5 -


i'm creating small mockup social network in laravel 5. want use sqlite database keep things small , local. i'm having trouble, however, getting work.

here's code (using blade) use table display row in database:

@extends('layouts.master')  @section('title')     testing2 @stop  @section('content') second test <a href="/">back page 1</a>  <table>     <tr><th>author</th>         <th>text</th></tr>     @foreach($posts $post)         <tr>             <td>                 {{$posts->author}}             </td>         </tr>         <tr>             <td>                 {{$posts->text}}             </td>         </tr>     @endforeach </table> @stop 

"author" , "text" being 2 columns in database. here route use generate page:

route::get('test2', function () {     $sql = "select * posts";     $posts = db::select($sql);     return view::make('test2')->withposts($posts); }); 

i know database there, i've placed in /database directory of app:

enter image description here

lastly, modified config\database.php file set sqlite default database:

enter image description here

when try , view blade page using route function, following error: "sqlstate[hy000] [2002] no connection made because target machine actively refused it."

i'm doing wrong somewhere connecting database, don't know what. have set properly?

place database in storage folder , mention path in database. should have php driver installed.

do in app/config/database.php:

<?php return array( 'default' => 'sqlite', 'connections' => array(     'sqlite' => array(         'driver'   => 'sqlite',         'database' => __dir__.'/../database/production.sqlite',         'prefix'   => '',     ), ), ); ?> 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -