I am creating a Laravel eCommerce application. I am following this tutorial on youtube: https://www.youtube.com/watch?v=L3EbWJmmyjo&list=PLEhEHUEU3x5oPTli631ZX9cxl6cU_sDaR&index=18
For the Admin section of the website, I am using Voyager. On my localhost, everything seems to be working perfectly:
The landing page (http://localhost:8000):
When I then enter the link: http://localhost:8000/admin it takes me to the http://localhost:8000/admin/login:
I then enter these credentials (images show database as well). As you can see the credentials match and when I press login I'm taken to the dashboard:
All the screenshots so far are on my localhost. When I am trying to install Voyager on my live website it stops working! This is my live web address: https://janinevalerieaesthetics.com
I am hosting using Forge and Envoyer. And they are linking using my GitLab account: https://gitlab.com/rossi99/salonwebsite
I connect to my Forge server using ssh through my terminal using this link: ssh [email protected]
And then I cd all the way into the current directory (the one that hold all my folders including the 'vendor' file and 'artisan') and then I use the php artisan commands to install the voyager package (https://voyager-docs.devdojo.com/getting-started/installation) :
- Changing the .env file:
Installation Steps:
APP_URL=http://localhost
My .env:
APP_URL=https://janinevalerieaesthetics.com
Installation Steps:
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
My .env:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=forge
DB_USERNAME=forge
DB_PASSWORD="**************"
I thne run this command from my terminal forge@salonWebsite:~/janinevalerieaesthetics.com/current$ :
php artisan voyager:install
I then make a user from the same terminal using this command :
php artisan voyager:admin [email protected] --create
Here is my live database tables:
And here is the roles table ( you can see that user with ID 1 is the admin):
But when I navigate to https://janinevalerieaesthetics.com/admin/login it shows the login screen:
But when I log in with the correct credentials, instead of login me in and showing the admin dashboard, it logs me in and takes me to the landing page and when I try to manually get to the log in it just redirects me to the landing page:
I found the answer for anyone else having this issue. When I inspected my 'seeds' directory, I did not have a 'DatabaseSeeder.php' file. I then created this by simply right-clicking and then creating DatabaseSeeder.php in mt seeds directory, I then added this code into it:
I then had to back into my terminal and run the following commands:
This will then populate the database of your live site. I then tried to log in with an existing user and it didn't work. I had to create a new admin user using this command in the '/current$' directory:
You will then be prompted for a username and password for your admin and once these are entered you can then navigate to: https://yourURL.com/admin/login and enter the details of your user and you will be navigated to you the dashboard!