E1f19cf8475094b78f39528042603a4ca2f248ea
By:
valon1x

Laravel 5.1 some tutorial.

July 18, 2015 3.4k views
PHP Frameworks MySQL Ubuntu

Hello, i am new in Laravel and in DigitalOcean too :)
I create droplet, install Vesta and after install Laravel 5.1
I have several questions:
1) How i must config database connect to my vesta mysql params.
2) I need .env file and in config/database.php use 'host' => env() or i must use 'host' => 'localhost' (or my ip of the sever) i as this because i install laravel debug panel https://github.com/barryvdh/laravel-debugbar and i get this errors
Cannot add listen to Queries for Laravel Debugbar: SQLSTATE[28000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)
/home/admin/web/default.domain/publichtml/vendor/barryvdh/laravel-debugbar/src/LaravelDebugbar.php#316
Exception
SQLSTATE[28000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)
/home/admin/web/default.domain/public
html/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php#50
PDOException

i not use homestead, i dont`know what is this. i think its like xamp(lamp/wamp) i use my droplet.
3) Laravel has something like YII gii or CakePHP (code generator from database with relationships) ?
In the terminal i try use command
php artisan make:model User
php artisan make:migration createuserstable
after
php artisan make:migration addvotestouserstable --table=users

php artisan make:migration createuserstable --create=users
in terminal all succesfully and i see new models, controllers, but in my database - not.

What i want - i want use PHPSTORM 9 and create, edit files and upload to server.

1 Answer

It is finding the database, but denying access for the homestead user.

Homestead is a Vagrant box containing the full Laravel development environment aiming to make it simple to get everything up and running locally. As the Laravel database docs mention, by default the .env file is configured for using Homestead:

By default, Laravel's sample environment configuration is ready to use with Laravel Homestead, which is a convenient virtual machine for doing Laravel development on your local machine. Of course, you are free to modify this configuration as needed for your local database.

In your .env file, you need to specify the username, password, and database as well as your host.

DB_HOST=localhost
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=mysupersecretpassword
Have another answer? Share your knowledge.