Complete Laravel & Vue Blog Tutorial with Sanctum Authentication
If you are looking to create a complete blog application using Laravel and Vue, with API authentication using Laravel Sanctum, then you have come to the right place. In this tutorial, we will guide you through the process of setting up a blog application with Laravel on the backend and Vue on the frontend, while using Sanctum for API authentication.
Prerequisites
Before you start, make sure you have the following installed on your system:
- PHP
- Composer
- Node.js
- NPM
- Laravel
Setting up Laravel
To get started, create a new Laravel project using the following command:
laravel new blog
Next, navigate to the project directory and install Sanctum:
composer require laravel/sanctum
After installing Sanctum, run the migrations:
php artisan migrate
Setting up Vue
Next, install Vue in your Laravel project using the following command:
npm install
Then, install Axios for making API requests:
npm install axios
Once Vue and Axios are installed, you can start building your frontend components and make API requests to your Laravel backend.
Creating the Blog Application
Now that you have set up your Laravel backend and Vue frontend, you can start creating the blog application. This includes setting up routes, controllers, models, and views for managing blog posts.
Implementing Sanctum Authentication
With the blog application in place, it’s time to implement authentication using Sanctum. You can create APIs for user registration, login, and logout, and protect your blog post APIs with Sanctum’s authentication middleware.
Conclusion
By following this tutorial, you will have a complete blog application with Laravel and Vue, using Sanctum for API authentication. This will not only help you understand the fundamentals of building a full-stack application, but also showcase the power and simplicity of using Laravel and Vue together.
good job man, what do you think about creating an Ecommerce using the same technologies? very good work on this project!
Good day! I am in the process of learning laravel and i found your laravel tutorials (for ex. about Services, Service providers, Facades etc.) and explanations the most useful among other youtubers, but now i see that some of the videos are restricted. Is it temporary?
great see more apps . laravel vuejs composition api with sanctum
Hey, im still new to laravel .To be honest your tutorials has been great help to me. I was hoping if you could add comments and reply comments to the blog .And if you could really dive into eloquent relationships. I kinda get confuse sometimes.Good job tho
Is this a single page app sir?