Support the ongoing development of Laravel.io →
posted 10 years ago
Database
Last updated 2 years ago.
0

You might need to change how Laravel is detecting which environment you are using. In the homestead.yaml file add an environment variable for 'local' if there is not one already. Make sure you change the database name in the app/config/local/database.php

variables:
    - key: ENV
      value: local

Then in the main directory of your app go to /app/bootstrap/start.php

Add the following code in detect environment.

$env = $app->detectEnvironment(function(){
        return getenv('ENV') ?: 'development';
});

Note: to use artisan on the command line you will have to add "--env=local" to all of your commands if you use this method.

You can change which database your Laravel app uses. Homestead uses a homestead DB by default so that you can skip a step if you only have one site.

To add a new database navigate the homestead directory using the console and then:

$ vagrant ssh
$ mysql -uhomestead -p
$Enter Password: secret
mysql> create database foo

Then in your local configuration folder in your Laravel app change the database name to "foo" or whatever you want to name your new database.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

fantata fantata Joined 31 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.