
Install Laravel 10 using composer, create a local project named Laravel basics, connect to the database via dot env, and start the server with php artisan serve.
Use Laravel migrations to create the students table with id, name, email, phone number, and gender, and run PHP artisan migrate to generate created_at and updated_at.
Learn how Laravel's eloquent models interact with database tables, customize table names and primary keys, and load models in controllers to perform insert, update, delete, or select queries.
Explore Laravel seeders and factories to generate fake data for your application, including seeding the students table with a seeder or a factory.
Explore middleware in Laravel, including global, group, and route middlewares. Learn how to configure, register, and apply them to protect routes and filter HTTP requests.
Launch a Laravel api in phase one without authentication, creating an employee table and crud endpoints (list, detail, create, update, delete) with proper http methods and database integration.
Create a Laravel migration class to design an employees table with id, name (120), email (50), nullable phone, age (integer), and gender (male, female, other); run php artisan migrate.
Create a Laravel 10 api controller using php artisan, place it in app/http/controllers/api, and implement add, list, single, update, and delete employee methods with proper routes and http verbs.
Create a Laravel model for the employees table using PHP artisan, set timestamps false, define fillable fields, and instantiate the singular employee model in an API controller.
Register api routes via routes/api.php and an api controller, creating post, get, put, and delete routes for add, list, single, update, and delete employee with an api prefix.
Build a list employee API in laravel 10 using the employee model, the list-employee method, and a get route to return all employees from the employees table.
Build a single employee data API in Laravel 10 by passing an ID in the URL to fetch the record with where and first, and return a JSON response.
Learn to update an employee via a Laravel 10 API by passing form data and id, validating existence, updating fields, and returning a JSON response with put method spoofing.
Execute delete employee API by validating existence with a where exists check, then locate and delete the employee, returning a success message when deleted or a no employee found message.
Develop and configure two Laravel API controllers—student and project—defining register, login, profile, and logout methods, plus add, list, get, and delete project APIs secured with Sanctum tokens.
Explore Sanctum authentication in Laravel 10, a composer package for token-based APIs with middleware, default config, and the personal access tokens table plus prune expired tokens command.
Configure Laravel 10 api routes with auth sanctum middleware, define open routes for student register and login, and protected routes for profile, logout, and project management (add, list, single, delete).
Build a student register API with Laravel 10 by validating name, email, password, and phone, enforcing unique emails, hashing passwords, creating a student model, and returning a json response.
Learn to access the student profile API with Laravel Sanctum authentication, using an authorization header and the Laravel auth helper to retrieve profile data after token verification.
Implement the student logout API in Laravel using sanctum tokens, deleting the current user token via the auth helper and authorization header.
Create a protected add project API that reads token from header to obtain the student id, validates title and description, saves the project with duration, and returns a success response.
List projects by authenticating with a token, fetch the student id, query the projects by student id, and return a json response with status, message, and data.
Fetch a single project by validating the token's student id and the URL's project id, then check existence and return the project data.
Learn how to implement the delete project API with token-based authorization, validating student and project IDs from the URL, checking existence, and returning success or no project found responses.
Learn to set up a Laravel 10 api with jwt authentication, creating users and courses tables, registering and logging in users, and accessing protected routes via jwt tokens.
Create migrations for users and courses tables, add phone_number to users, define courses with user_id, title, description, total_videos, remove timestamps, run migrations, and fix credentials.
Create api controllers for two modules: user and course, implementing registration, login, profile, logout, course enrollment, list courses, and delete course with token-based access.
------------------------------------
Step-by-Step JWT Package Setup
------------------------------------
1. Composer command:
> composer require tymon/jwt-auth
2. Add Provider (/config/app.php):
> Tymon\JWTAuth\Providers\LaravelServiceProvider::class,
3. Add Aliases (/config/app.php):
'Jwt' => Tymon\JWTAuth\Providers\LaravelServiceProvider::class,
'JWTFactory' => Tymon\JWTAuth\Facades\JWTFactory::class,
'JWTAuth' => Tymon\JWTAuth\Facades\JWTAuth::class,
4. Publish "jwt.php" file:
> php artisan vendor:publish --provider="Tymon\JWTAuth\Providers\LaravelServiceProvider"
5. Run Migration Command:
> php artisan migrate
6. Generate JWT Secret Token, updates .env file:
> php artisan jwt:secret
7. Update "/config/auth.php", add into guards array:
'api' => [
'driver' => 'jwt',
'provider' => 'users',
],
8. Update User.php (Model):
> Import this, use Tymon\JWTAuth\Contracts\JWTSubject;
> Add with class declaration, "implements JWTSubject"
Add these methods,
public function getJWTIdentifier()
{
return $this->getKey();
}
public function getJWTCustomClaims()
{
return [];
}
9. Great! Now, available middleware "auth:api"
Thank you [ https://jwt-auth.readthedocs.io/en/develop/auth-guard/ ]
Learn to create a user login API in Laravel 10, validate email and password, generate a JWT token via JWT auth, and return a JSON success or invalid details response.
Secure a user profile API in Laravel 10 by using a JWT bearer token in the authorization header, validated by auth middleware and the auth helper to return profile data.
Explore refreshing access tokens with a refresh token, use bearer authorization for protected routes like profile, and securely logout to destroy the current token.
Learn to implement a list user’s courses API in Laravel 10 using a one-to-many relation between users and courses, authenticated with a bearer token, and returning a json response.
Create a delete user course API by validating the URL course id and auth user id, checking course existence, and deleting the record via JWT-authenticated requests.
Create authors and books migrations in Laravel 10, defining authors (id, name, email, phone number, password) and books (id, author_id, title, description, book_cost), then run migrations to create the tables.
Create api models for author and book in Laravel 10 using artisan make model, set author fields name, email, phone, password and fields author_id, title, description, book_cost, and disable timestamps.
Step #1: composer require laravel/passport
Step #2: php artisan migrate
Step #3: php artisan passport:install
Step #4:
Go to Author Model class
>> use Laravel\Passport\HasApiTokens;
use Illuminate\Auth\Authenticatable;
use Illuminate\Contracts\Auth\Authenticatable as AuthContract;
>> "implements AuthContract"
>> Add "HasApiTokens, Authenticatable"
Step #5:
Open auth.php from /config folder.
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
Go to providers,
'users' => [
'driver' => 'eloquent',
'model' => App\Models\Author::class,
],
Great! you can use middleware for apis: "auth:api"
Set up api routes with open registration and login endpoints; protect profile, logout, and book operations (save book, list books, delete book with book id) under the auth middleware.
Create the author register API by validating form data, hashing the password, and saving a new author to the authors table, returning a JSON success message.
Explore creating an author login API in Laravel 10 by validating email and password, using the Auth facade's attempt, and issuing a passport access token named my token.
Learn to implement a protected logout API in a Laravel 10 app by destroying the current token with the auth helper, ensuring future requests require reauthentication.
Learn to build a safe author book API with a Laravel 10 book controller, validating title, authenticating with a passport token, and creating books with author id, description, and cost.
It is very amazing to work with Laravel framework.
REST stands for Representational State Transfer. A RESTful API uses a set of guidelines that define how the API should be constructed and how it should handle requests and responses.
You will learn the complete idea of Beginners To Advance Laravel 10 APIs Development Tutorials. Basic Experience in Laravel MVC & MySQL required.
Begin your journey of Laravel 10 REST APIs Development with MySQL database driver here.
If you have just decided to learn Laravel concepts to create REST APIs then you have made the right choice, so take a breath. Beginners To Advance Laravel 10 APIs Development Tutorials is very easy to learn which means that you will be through the basics and on to writing standard in a very short time.
Inside this course “Laravel REST APIs Development” you will learn the complete details of Basics of Laravel framework to create web application apis. We will cover the whole basic concept from stage of beginners to creating web apis with authentication in application development.
You’ll get the concept of all building blocks of API Development in Laravel framework via it’s basic sessions of this class.
Overall, inside this well structured of Laravel API Development course you will learn:
– Basics of API Development Using Laravel framework
– Learn about all Database Queries like Insert, Update, Delete, and Select
– Learn about Request and Response flow with calls of APIs
– How To work with CRUD APIs in Laravel
– Queries Handling using Laravel eloquent class
– How To Create RESTful APIs using Sanctum, JWT, Passport Authentication in Laravel framework
– Process of Registration, Login, get Profile data, etc.
– API Development standards of Laravel framework
This course is for every development level. For beginners, it is perfect to enroll and learn development in a detailed way.