alijumaan / laravel-ecommerce

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't use abort / abort_if functions outside http layer

Ch4mpl00 opened this issue · comments

https://github.com/alijumaan/Laravel-Ecommerce/blob/4b88d4b63f121e0dc837a8518f39df93f86d22d1/app/Repositories/Backend/CategoryRepository.php#L33

Here you call abort_if from a repository but it is not a repository responsibility to abort request.
Repository might throw an exceptions but not http related.

Also checking if user is allowed to do something is also not a repository responsibility.

You are right, I will move all "if statement" to the controller or any PHP class like service or job.