company has multiple departments and each employee works in one of the departments. Each employee may have multiple contact numbers and addresses:
-
Clone the repo and run below command:-
composer install -
Add database details in .env file create .env from .env.example
-
Run migration to create database tables:-
php artisan migrate -
Run Passport install for personal access client:-
php artisan passport:install -
Run api endpoints in api client and run server:-
php artisan serve -
First register and login the user then auth token will get generate
end points for registration and login- api/register
Parameters:-
name: text
email: text email
password: text or number
password_confirmation: sam as password
Then auth token got genarated use to run department and employee api
- api/login
Parameters:-
email: text email
password: text or number
Then auth token got genarated use to run department and employee api
- api/register
-
Below are the end points for department and employee
First Create departments:-- POST api/department => create department
Header Parameters:-
Authorization: Bearer token
Form Parameters:-
dep_name: text
-
GET api/department => get all department
Header Parameters:-
Authorization: Bearer token
-
GET api/department/id => get department by id
Header Parameters:-
Authorization: Bearer token
- PUT api/department/id => Update department by id
Header Parameters:-
Authorization: Bearer token
Form Parameters:-
dep_name: text
- DELETE api/department/id => Delete department by id
Header Parameters:-
Authorization: Bearer token
Employee api endpoints:-
- POST api/employee => create employee
Header Parameters:-
Authorization: Bearer token
Form Parameters:-
name: text
age: text
job: text
salary: number
dep_id: text
contacts: number (or pass as array like contacts[0],contacts[1],... for multiple contact creation )
address: text (or pass as array like address[0],address[1],... for multiple address creation)
-
GET api/employee => get all employee's with associated contacts and address
Header Parameters:-
Authorization: Bearer token
-
GET api/employee/id => get employee details by id with associated contacts and addresss
Header Parameters:-
Authorization: Bearer token
- PUT api/employee/id => Update employee by id
Header Parameters:-
Authorization: Bearer token
Form Parameters:-
name: text
age: text
job: text
salary: number
dep_id: text
contacts: number (or pass as array like contacts[0],contacts[1],... for multiple contact creation )
address: text (or pass as array like address[0],address[1],... for multiple address creation )
- DELETE api/employee/id => Delete employee by id
Header Parameters:-
Authorization: Bearer token
- GET api/search-employee => Search employee by name
Header Parameters:-
Authorization: Bearer token
Query Parameters:-
name: text
- POST api/department => create department