Hi
I created my own OAuth Middleware and got a question about using it with Slim-Skeleton.
I got 2 layers of middleware.
First - Checks Token and validate it. When it is ok, I add it to request as an attribute.
Second - Check if the User email is registered:
User::where(‘email’, $data[‘email’])->firstOrFail();
Now when I got the User model I add it again to request attribute.
Next I got my routes Actions that Extend the main Action in which I take the User Model out of the request and put it in the main protected variable in MainAction.
And here is my question.
Cause I can have my all DB functionality inside User model like take all orders like this:
return $this->respondWithData($this->user->orders()->get()->toArray());
So do I need Repositories at all if my data logic is like this??
Is it ok and save to have it like that ??
Do I break some big workflow patterns?
Everything is working nicely but it turns out I’m removing quiet a big amount of code and functionality from Slim Skeleton and I’m worried that I’m taking to much.
Is there a better way to pass it from Middleware to Action
Any suggestions and thoughts about this approach ??
Regards
Peter