This might be silly question, but since I am new to laravel, I am finding it somewhat difficult to setup database. I am using laravel 5.2. IN config>database.php these are my settings
'default' => env('DB_CONNECTION', 'mysql'),
and for mysql :
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'database' => env('DB_DATABASE', 'larasite'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
Then I also changed .env and .env.example file's settings
DB_HOST=localhost
DB_DATABASE=larasite
DB_USERNAME=root
DB_PASSWORD=""
Now when in routes.php I have this code:
Route::get('about', function(){
$posting = DB::query('select * from posts');
dd($posting);
});
And then when I visit localhost:8000/about I get following error.
Builder {#118 ▼
#connection: MySqlConnection {#114 ▶}
#grammar: MySqlGrammar {#115 ▶}
#processor: MySqlProcessor {#116}
#bindings: array:6 [▶]
+aggregate: null
+columns: null
+distinct: false
+from: null
+joins: null
+wheres: null
+groups: null
+havings: null
+orders: null
+limit: null
+offset: null
+unions: null
+unionLimit: null
+unionOffset: null
+unionOrders: null
+lock: null
#backups: []
#bindingBackups: []
#operators: array:26 [▶]
#useWritePdo: false
}
I noticed that, even If I change settings and enter wrong details, I get same error. What's happening? How to solve this?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1QLN38G
via IFTTT
Aucun commentaire:
Enregistrer un commentaire