1) Install Laravel Fresh New Setup
To install a fresh Laravel project, run the following command:
2) Setup Database Credentials
After installing Laravel, configure the database in your .env
file with the correct credentials:
Next, run the migration to create the default tables:
3) Make Routes
In routes/web.php
, create routes for login, registration, post-data, and dashboard.
4) Create Controller
Generate the AuthController
with the following Artisan command:
Now, open the app/Http/Controllers/AuthController.php
file and add the following methods:
5) Create Blade Views
a) login.blade.php
In resources/views/login.blade.php
, create the login form:
b) registration.blade.php
In resources/views/registration.blade.php
, create the registration form:
c) dashboard.blade.php
In resources/views/dashboard.blade.php
, create the dashboard view:
6) Run Development Server
Run the Laravel development server using:
Conclusion
You now have a basic authentication system in Laravel with routes, controllers, views, and a working login, registration, and dashboard flow. You can enhance and customize this as needed for your application.