Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kei-k23/laravel-ums-api
Laravel 11 user management system API with Passport auth
https://github.com/kei-k23/laravel-ums-api
api laravel passport sqlite3 user-management
Last synced: about 1 month ago
JSON representation
Laravel 11 user management system API with Passport auth
- Host: GitHub
- URL: https://github.com/kei-k23/laravel-ums-api
- Owner: Kei-K23
- Created: 2024-08-08T09:26:49.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-09T04:07:31.000Z (5 months ago)
- Last Synced: 2024-08-09T11:55:59.819Z (5 months ago)
- Topics: api, laravel, passport, sqlite3, user-management
- Language: PHP
- Homepage:
- Size: 75.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Employee Management API
This is a Laravel 11 backend API for managing customers. The API includes authentication via Laravel Passport and CRUD operations for employee records.
## Requirements
- PHP >= 8.0
- Composer
- Laravel >= 10.x
- Laravel Passport
- MySQL or any other supported database## Installation
1. **Clone the repository:**
```bash
git clone https://github.com/Kei-K23/laravel-ums-api.git
```2. **Navigate to the project directory:**
```bash
cd laravel-ums-api
```3. **Install dependencies:**
```bash
composer install
```4. **Setup the environment variables:**
Copy the `.env.example` file to `.env` and configure your database and other settings.
```bash
cp .env.example .env
```5. **Setup private and public key**
Setup your own env variables for private and public key in `.env` file for Laravel passport. Key generation website [https://cryptotools.net/rsagen](https://cryptotools.net/rsagen)
6. **Generate application key:**
```bash
php artisan key:generate
```7. **Migrate the database:**
```bash
php artisan migrate
```8. **Generate passport keys:**
```bash
php artisan passport:keys --force
```9. **Setup passport client:**
```bash
php artisan passport:client --personal
```10. **Run the server:**
```bash
php artisan serve
```## API Endpoints
### Authentication
- **Register:** `POST http://localhost:8000/api/auth/register`
Registers a new user.
#### Request payload
```json
{
"name": "John Doe",
"email": "[email protected]",
"password": "your_password"
}
```- **Login:** `POST http://localhost:8000/api/auth/login`
Login user.
#### Request payload
```json
{
"email": "[email protected]",
"password": "your_password"
}
```### Customer
- **Create new customer:** `POST http://localhost:8000/api/customers`
Create new customers.
#### Request payload
```json
{
"name": "nono",
"email": "[email protected]",
"position": "USER",
},
```- **Get all customers:** `GET http://localhost:8000/api/customers`
Get all customers.
#### Response payload
```json
[
{
"id": 1,
"name": "nono",
"email": "[email protected]",
"position": "USER",
"created_at": "2024-08-08T07:50:08.000000Z",
"updated_at": "2024-08-08T13:52:06.000000Z"
},
...
]
```- **Get employee by id:** `GET http://localhost:8000/api/customers/1`
Get employee by id.
#### Response payload
```json
{
"data": {
"id": 1,
"name": "nono",
"email": "[email protected]",
"position": "USER",
"created_at": "2024-08-08T07:50:08.000000Z",
"updated_at": "2024-08-08T13:52:06.000000Z"
}
}
```- **Edit/update the employee:** `PUT http://localhost:8000/api/customers/1`
Edit/update new employee.
#### Request payload
```json
{
"name": "nono Update",
"email": "[email protected]",
"position": "USER",
},
```- **Delete the customer:** `DELETE http://localhost:8000/api/customers/1`
Delete the customer.
#### Response payload
```json
{
"message": "Successfully deleted",
},
```