Step 1: Install Laravel Project
First, you need to install a fresh Laravel project. Run the following command to create a new Laravel project:
Step 2: Setup Database Credentials
-
Create a new database called
custom_auth
(or any name you prefer). -
Open the
.env
file in the root of your Laravel project and add your database credentials:
-
Run the migration command to generate default tables in your database:
Step 3: Add Styles (CSS)
You can add the CSS styles provided in your public/assets/css/style.css
file. The file will contain custom styles for the authentication forms.
-
Create the
assets/css
folder if it doesn’t exist. -
Add the provided
style.css
content intopublic/assets/css/style.css
.
Step 4: Create Register Page Routes
Open routes/web.php
and define routes for the login and signup pages:
Step 5: Create Register Page Controller
Run the following command to create a controller for handling user authentication:
This will create a RegisterController.php
file inside the app/Http/Controllers/Auth
directory. You will define the necessary methods (e.g., index
, postLogin
, etc.) in this controller.
Step 6: Create the Register Page (View)
Now, create the view for the signup page. Create a new file resources/views/signUp.blade.php
and add the following HTML code:
Final Notes:
-
You can customize the
AuthenticationController
to handle login logic as needed. -
The view (signup page) will allow users to input their email, password, and confirm their password for signup. You can use Laravel's built-in validation to ensure that the passwords match and follow other rules.
-
The
public/assets/css/styles.css
file should already contain your custom styles.