I'm going from no-framework development to my first contact with Laravel (using version 5.1) and I'm a bit overwhelmed with the amount of stuffs to handle (migrations, seeds, hateoas, transformers, unit testing, error handling, etc).
I'd like to get some help at the return of the show method
portion of it (following REST concepts). I have the following database structure:
companies -> users -> tickets -> interactions -> attachments
Now, when listing a specific ticket (like GET /customers/5/tickets/3
), the screen needs to show all interactions for that ticket, along with all information in the ticket table (sort of like a page header) and the name of each user that created the specific interaction.
Thinking in terms of relationship, should I return all that data from the single call or should the information from the tickets table, for instance, be persisted in the front-end (from the index method
call)? Even if I should persist the ticket information (header of the page), I am still left with interaction join users
+ N attachments for each interaction. What are the options to approach this?
I decided to open this thread because I was trying to Unit Test this call and I couldn't decide whether I should seed the database to have all the information necessary for it to work.
Aucun commentaire:
Enregistrer un commentaire