0

I have started learning Laravel 5.1 and I wanted to find the reason why the "Policies" are apart from the model functions. I think that the kind of logic that policies deal with could be done by models alone. Maybe I think like this because I come from working with Codeigniter which is less complicated.

Besides the few instances where an app reuses the same policies over multiple policies, is it bad practice to use the policy logic in the model?

vladimir.gorea
  • 641
  • 1
  • 8
  • 27
  • https://laravel.com/docs/5.1/authorization#policies "Since defining all of your authorization logic in the AuthServiceProvider could become cumbersome in large applications, Laravel allows you to split your authorization logic into "Policy" classes." – Jonathan Jun 12 '16 at 18:47
  • As a side note - Laravel 5.2 is out, and while it's not LTS, 5.(5/6) will be. I would recommend moving to Laravel 5.2 as there are some significant changes already. – Ohgodwhy Jun 12 '16 at 19:41
  • @Ohgodwhy For a moment I was going to say the same thing as I mistakenly thought 5.2 was the LTS release. – Jonathan Jun 12 '16 at 21:40
  • Thanks for your comments, but they don't answer my question as I was asking about checking for authorization inside the model, not in the AuthServiceProvider – vladimir.gorea Jun 13 '16 at 12:00

0 Answers0