Booking_Management_with_Laravel_and_Svelte Svelte Themes

Booking_management_with_laravel_and_svelte

Progress

27.10.23

  • tried to get an over view of the Laravel components: LaravelComponents.md
  • completly new Laravel installation
  • added mogration, model, controller and routes for Location, Member, Staff and Booking
  • Staff and Member are using the same User table, but have different role
  • relationships are setted up:
    • Location has many Staff
    • Location has many Member
    • Staff has many Member
    • Member has many Booking
  • added factory and seeder for all models
  • using Bruno for testing the API, all files are in the Bruno folder
  • added login via API
  • there are three Users to test the login:
  • added CRUD for Staff -> Member
  • binded name, emailand role from the User Modell to the Member Modell
  • tried to write a jurnal for the progress: jurnal.md, but it is now partially outdated
  • project ist ready to use, SQLite database and no secrets in the .env file
  • initial commit

03.11.23

  • rebuild the way to divide the User-roles (using Middleware)
  • moved the code from the MemberController to the Member Model
  • use Scopes to filter the Member
  • use select & join to get the data from the database
  • made a benchmark against withs and joinis faster
  • added inviteMail endpoint to send an email to a new Member
  • added register endpoint to register a new Member
  • use the customJson to format the response inkl. Exception handling

Issues

  1. handle two different roles (staff, member) with the same user table is annoying. For every request we need to check the role and get the data from the right table. And both table have timestamps. Is there a better way?
  2. There will be no response after a Member is deleted
  3. I a non existing Member is requested, there will be an ugly response:"message": "No query results for model [App\\Models\\Member]
  4. decide if we sort out the active member in the backend (/member?active) or in the frontend

ToDo

  • better error messages:
    • if a Member is deleted, there should be a response
    • if an email is already in use and a new Member is created with this email, there should be a response

Eloquent question, get relationship from collection

php - Laravel get a collection of relationship items - Stack Overflow

Responses and Status Codes

All requests and responses are of an application/json content type and follow typical HTTP response status codes for success and failure.

  • 200 - Everything is OK
  • 201 - Created Successfully
  • 202 - Accepted
  • 204 - No Content
  • 301 - Moved Permanently
  • 400 - Bad Request
  • 401 - Unauthorized
  • 404 - Not Found
  • 500 - Internal Server Error

The API follows the general rule that all 200 codes are deemed successful, 300 codes denote a redirection, 400 codes are client errors and 500 codes are server errors.

Actions Handled By Resource Controller

Verb URI Action Route Name
GET /photos index photos.index
GET /photos/create create photos.create
POST /photos store photos.store
GET /photos/{photo} show photos.show
GET /photos/{photo}/edit edit photos.edit
PUT/PATCH /photos/{photo} update photos.update
DELETE /photos/{photo} destroy photos.destroy

Top categories

Loading Svelte Themes