Are you calling app/views/test.php directly? Or are you using index.php with a route/controller? Can you show your code to render the view?
barryvdh said:
Are you calling app/views/test.php directly? Or are you using index.php with a route/controller? Can you show your code to render the view? Hi barryvdh,
You need to use a route and/or controller so that Laravel is booted and all the necessary resources are loaded, simply accessing the view.php will only run that script and won't load any of the Laravel system, hence DB class not being found.
You should set /public to your document root so that all requests are rewritten to the index.php and so are processed by Laravel.
Create a route in your routes.php
Route::get('/testdb', ['uses' => 'TestDbController@testDB');
Then load http://localhost/testdb (after you've set /public as your document root)
Hi, i have solved it, thanks again @iWader , i should create a Model for testDB, and refresh it with command:
php artisan dump-autoload
so that laravel know such a thing. And i should configurate 2 place of database.php. One is in app/config/database.php, the other is in app/config/local/database.php.....i don't konw why in this folder exist again a database.php. But i configurate it and finally success to connect to database. And this tutorial give me also a lot of help, see: http://www.amazingcode.de/laravel-4-1-erstellen-einer-blog-applikation-teil-1/
I suggest reading the docs (http://laravel.com/docs/4.2) and following some beginner tutorials, perhaps on https://laracasts.com
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community