-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Here I will explain how to build a simple API for meeting purposes with Laravel 7 on windows 10 using Homestead. This project is based on the pluralsight course RESTful web services with PHP and Laravel by Maximilian Schwarzmüller.
- Setup the project
- Connecting to database
- Add controllers
- Add routes
- Add models and migration files
- Add relations
- Add mass assignment for Meeting model
- Requests and responses
- Stateless authentication
- Authentication with Sanctum
- Test the API
Note: to enable cors you will need to add a third party package. Take a look at the question in Stackoverflow.
The idea of this project, is to design and structure a RESTful service where users can create, update, and delete meetings. Users should be able to register and unregister for any created meetings. Finally, it should be possible to retrieve a list of all meetings and info about an individual meeting.
- To implement this functionnalities, we will need the following actions:
Authentication required | No authentication required |
---|---|
Create Meeting (POST) to /api/v1/meeting : |
Create User (POST) to /api/v1/user : |
- Receive: Title, Description, Time, User ID | - Receive: First name, Last name, e-mail, password |
- Send: Message, Summary, Meeting URL, Participants | - Send: Message, Summary |
Update Meeting (PATCH) to /api/v1/meeting : |
Get List of all Meetings (GET) to /api/v1/meeting : |
- Receive: Title, Description, Time Meeting ID, User ID | - Receive: (no data) |
- Send: Message, Summary, Meeting URL, Participants | - Send: Meetings info, Links to individual Meetings |
Delete Meeting (DELETE) to /api/v1/meeting : |
Get Data about individual Meeting (GET) to /api/v1/meeting : |
- Receive: Meeting ID, User ID | - Receive: Meeting ID |
- Send: Message | - Send: Meeting info, Link to list of meetings |
Register for Meeting (POST) to /api/v1/meeting/registration : |
User signin (POST) to /api/v1/user/signin : |
- Receive: User ID, Meeting ID | - Receive: e-mail, password |
- Send: Message, User info, Meeting info, Unregistration link | - Send: token (Sanctum) |
Unregister from Meeting (DELETE) to /api/v1/meeting/registration : |
|
- Receive: User ID, Meeting ID | |
- Send: Message, User info, Meeting info, Registration link |
Before you start working with Laravel, make sure that either the Laravel (free) or Laravel Idea (paid) plugins are installed and enabled. Both plugins additionally require installing the Laravel IDE helper tool. For more info, see Laravel - Help | PhpStorm.
meeting-API - 2020