Exploring Laravel 11 with Inertia JS and Vue JS: User roles, Profile customization, Dark mode, and beyond – Part 1: Introduction

Posted by


In this tutorial, we will be building a Laravel 11 application using Inertia JS and Vue JS. We will be implementing user roles, user profile, dark mode feature, and more.

2 Setting Up Laravel 11

First, make sure you have Laravel 11 installed on your system. If you haven’t already installed Laravel, you can do so by running the following command:

composer create-project laravel/laravel my-project

Next, navigate to your project directory and start the Laravel development server by running the following command:

php artisan serve

Now, you should be able to see the Laravel welcome page when you visit http://localhost:8000 in your browser.

3 Installing Inertia JS

Inertia JS is a library that allows you to build single-page applications with Vue JS and Laravel. To install Inertia JS in your Laravel project, run the following command:

composer require inertiajs/inertia-laravel

Next, you need to publish the Inertia configuration file by running the following command:

php artisan vendor:publish --tag=inertia-config

4 Installing Vue JS

Vue JS is a popular JavaScript framework for building user interfaces. To install Vue JS in your Laravel project, you can use npm. Run the following command to install Vue JS:

npm install vue

5 Creating the User Roles

In Laravel, you can implement user roles by using middleware. First, create a middleware for each role you want to define. For example, to create an Admin middleware, run the following command:

php artisan make:middleware Admin

Next, add the logic for the Admin middleware in the Admin middleware class. You can check if the user has the Admin role and allow/deny access based on that.

6 Implementing User Profile

To implement a user profile in your application, you can create a ProfileController and define the necessary routes to handle profile-related actions. You can add features like updating profile information, changing passwords, etc.

7 Implementing Dark Mode

Dark mode is a popular feature in modern applications. To implement dark mode in your Laravel 11 application, you can use a CSS framework like Tailwind CSS. Create separate CSS files for light mode and dark mode, and toggle between them based on user preference.

8 Conclusion

In this tutorial, we have learned how to build a Laravel 11 application with Inertia JS and Vue JS. We have implemented user roles, user profile, dark mode feature, and more. You can customize and expand upon these features to build a robust and user-friendly application.

I hope this tutorial was helpful to you. Happy coding!

0 0 votes
Article Rating
5 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
@Szchmausser
1 month ago

Wow! Excited for this new series, I have seen other videos of yours and they are too good. I was looking for this kind of project, but knowing this channel, I will learn to do these things from here. Thank you so much for this series of videos!

@aguud
1 month ago

wow 4 videos at once

@jeftaasw9389
1 month ago

thank you jon. btw will you make this with reactjs

@eramitgupta271
1 month ago

Thank you for create a video ❤

@vedastoquintans1784
1 month ago

I'm currently watching your Laravel 11 course. Thanks for uploading such amazing content, you're literally a hidden gem.