This Project is the First Laravel Project and The Target of this Project is to Try Php and Laravel to See how the Language and The Framework Looks Like when You Implement Logic and Database Connection, Response Mapper, Custom Database Query and Each Controller Implemented to be Based on Crud Implementation for Create , Update, Delete, Get and This project Designed to Be Always return Json Response Because UI Side Depends on Frontend Frameworks, Apps This is Just Server Side Logic
- Controllers is the Main Point For All Api's
- Services is the Logic of Each End Point
- Model is The Current Model Saved in Database
- JWT In Login Request
- Users Api
- Shops Api
- Items Api
- User Address Api
- Shop Branches Api
- Items Comments Controller
- Category Controller
-
DELETE : http://127.0.0.1:8000/api/v1/users
-
DELETE : http://127.0.0.1:8000/api/v1/users/1
-
GET : http://127.0.0.1:8000/api/v1/shops/users/addresses/enabled
-
GET : http://127.0.0.1:8000/api/v1/shops/users/addresses/disabled
-
DELETE : http://127.0.0.1:8000/api/v1/users/addresses/branches
-
DELETE : http://127.0.0.1:8000/api/v1/users/addresses/branches/1
-
DELETE : http://127.0.0.1:8000/api/v1/shops
-
DELETE : http://127.0.0.1:8000/api/v1/shops/1
-
DELETE : http://127.0.0.1:8000/api/v1/items
-
DELETE : http://127.0.0.1:8000/api/v1/items/1
For Example When You Create User This is the Request Body
{
"name": "Yazan Tarifi",
"image": "https://uxwing.com/wp-content/themes/uxwing/download/12-people-gesture/user-profile.png",
"password": "123456789",
"email": "yazan98@gmail.com",
"gender": "Male",
"age": 15,
"phone_number": "123456789",
"location_lat": 15.2,
"location_lng": 1548.2,
"location_name": "Amman",
"type": "Admin",
"security_question": "asdfasdsdfsdf",
"security_question_answer": "dsfsdfsefsedvsev"
}
{
"code": 201,
"message": "Data Found",
"status": true,
"path": "http://127.0.0.1:8000/api/v1/users",
"timestamp": 1618272720,
"data": {
"name": "Yazan Tarifi",
"image": "https://uxwing.com/wp-content/themes/uxwing/download/12-people-gesture/user-profile.png",
"email": "ya15zan98@gmail.com",
"gender": "Male",
"age": 15,
"phone_number": "12345671589",
"location_lat": 15.2,
"location_lng": 1548.2,
"location_name": "Amman",
"type": "Admin",
"created_at": "2021-04-13 00:11:59",
"is_enabled": 1,
"is_account_activated": 0,
"status": "NOT_VERIFIED",
"id": 2,
"is_account_enabled": 0
}
}
{
"code": 400,
"message": "Failed",
"status": false,
"path": "http://127.0.0.1:8000/api/v1/users",
"timestamp": 1618272664,
"error": 0,
"errorMessage": "Phone Number Already Used ...",
"stackTrace": "#0 E:\\shop-api\\app\\Http\\Controllers\\UsersController.php(24): App\\Models\\Services\\UserService->saveEntity()\n#1 E:\\shop-api\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php(54): App\\Http\\Controllers\\UsersController->saveEntity()\n#2 E:\\shop-api\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction()\n#3 E:\\shop-api\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(254): Illuminate\\Routing\\ControllerDispatcher->dispatch()\n#4 E:\\shop-api\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(197): Illuminate\\Routing\\Route->runController()\n#5 E:\\shop-api\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(695): Illuminate\\Routing\\Route->run()\n#6 E:\\shop-api\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php
{
"code": 200,
"message": "Data Found",
"status": true,
"path": "http://127.0.0.1:8000/api/v1/users/login",
"timestamp": 1618272942,
"data": {
"user": {
"name": "Yazan Tarifi",
"image": "https://uxwing.com/wp-content/themes/uxwing/download/12-people-gesture/user-profile.png",
"email": "yazan98@gmail.com",
"gender": "Male",
"age": 15,
"phone_number": "123456789",
"location_lat": 15.2,
"location_lng": 1548.2,
"location_name": "Amman",
"type": "Admin",
"created_at": "2021-04-10 16:38:42",
"is_enabled": 1,
"is_account_activated": 1,
"status": "NOT_VERIFIED",
"id": 7,
"is_account_enabled": 1
},
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC8xMjcuMC4wLjE6ODAwMFwvYXBpXC92MVwvdXNlcnNcL2xvZ2luIiwiaWF0IjoxNjE4MjcyOTQyLCJleHAiOjE2MTgyNzY1NDIsIm5iZiI6MTYxODI3Mjk0MiwianRpIjoiRzgzdjRhWVdlR3pRVFlGTCIsInN1YiI6NywicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.m2nUT8lCb-N8rH9hwYoL5LPBZEA50auP1LJDyDnQHlU",
"tokenKey": "Bearer"
}
}
{
"code": 400,
"message": "Failed",
"status": false,
"path": "http://127.0.0.1:8000/api/v1/users/login",
"timestamp": 1618272893,
"error": 0,
"errorMessage": "Incorrect Email Or Password Please Try Again",
"stackTrace": "#0 E:\\shop-api\\app\\Http\\Controllers\\UsersController.php(41): App\\Models\\Services\\UserService->loginAccount()\n#1 E:\\shop-api\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php(54): App\\Http\\Controllers\\UsersController->loginAccount()\n#2 E:\\shop-api\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction()\n#3
php artisan serve
php artisan migrate --force
php artisan migrate:refresh
php artisan make:migration create_shops_table