How would you login in admin user with credentials in env file?
Hi, I'm relatively new to laravel. I'm trying to log in a user without any records in the users table. The plan is to have the credentials for the admin in the env file.
THE QUESTION:
I know how to do the comparison, i know how to redirect the user to the next page after login. What session variables should be created before redirecting the user to the next page since the attempt method and $request->session()->regenerate() won't work?
TLDR;
How would you login in admin user with credentials in env file?
I have an admin user created as part of my migration files, that way I always have a known admin whenever I redo the database in dev or test. You can put environment checks around the creation in your migration, so you have different ones for different environments. And then of course, just do it manually in production.
@martinbean my boss doesn't want it that way. I'm actually thinking of adding an env variable called MODE and if env('MODE') == "demo" I'll ignore the auth middleware and redirect from the login function to the dashboard. Haven't tried it but that will be my next attempt.
TLDR; User should be able to login as admin. But the credentials shouldn't be in the database