无法理解使用 laravel 的 Facebook 身份验证

can't understand facebook authentication using laravel

我将通过本教程使用 Facebook 实施身份验证

http://www.codeanchor.net/blog/complete-laravel-socialite-tutorial/

但我不能完全理解 UserRepository 和 AuthenticateUser , 为什么我们要这样使用它们,而不是简单地将功能放在用户模型和用户控制器和 AuthController 上?

原因是 UserRepository 等 类 处理特定功能,因此您根据需要注入这些对象。将所有这些放在一起仍然可以工作,但是如果您没有明确的关注点分离,则很难长期维护 运行。

The value of separation of concerns is simplifying development and maintenance of computer programs. When concerns are well-separated, individual sections can be reused, as well as developed and updated independently. Of special value is the ability to later improve or modify one section of code without having to know the details of other sections, and without having to make corresponding changes to those sections.

阅读更多:

https://en.wikipedia.org/wiki/Separation_of_concerns