Preface: I\'m attempting to use the repository pattern in an MVC architecture with relational databases.
I\'ve recently started learning TDD in PHP, and I\'
I agree with @ryan1234 that you should pass around complete objects within the code and should use generic query methods to get those objects.
Model::where(['attr1' => 'val1'])->get();
For external/endpoint usage I really like the GraphQL method.
POST /api/graphql
{
query: {
Model(attr1: 'val1') {
attr2
attr3
}
}
}