{"id":30376,"date":"2019-10-31T21:35:14","date_gmt":"2019-10-31T18:35:14","guid":{"rendered":"https:\/\/prohoster.info\/blog\/poleznye-repozitorii-s-eloquent\/"},"modified":"2019-10-31T21:35:14","modified_gmt":"2019-10-31T18:35:14","slug":"poleznye-repozitorii-s-eloquent","status":"publish","type":"post","link":"https:\/\/prohoster.info\/de\/blog\/novosti-interneta\/poleznye-repozitorii-s-eloquent","title":{"rendered":"N\u00fctzliche Repositories mit Eloquent?","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>\u041d\u0430 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/en\/post\/444688\/\">\u0441\u0442\u0430\u0442\u044c\u044e \u043e \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0434\u043b\u044f Eloquent \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439<\/a><\/noindex>, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043e\u0431\u0435\u0449\u0430\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u044d\u0442\u043e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f:<\/p>\n<p><\/p>\n<pre><code class=\"php\">&lt;?php\ninterface PostRepository\n{\n    public function getById($id): Post;\n    public function save(Post $post);\n    public function delete($id);\n}<\/code><\/pre>\n<p><\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u0435\u0441\u043b\u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0442\u0430\u043a\u0438 \u0431\u044b\u043b\u043e \u0440\u0435\u0448\u0435\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0432 \u043d\u0438\u0445 \u0447\u0430\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u043e\u043a \u0437\u0430\u043f\u0438\u0441\u0435\u0439:<\/p>\n<p><\/p>\n<pre><code class=\"php\">&lt;?php\ninterface PostRepository\n{\n    public function getById($id): Post;\n    public function save(Post $post);\n    public function delete($id);\n\n    public function getLastPosts();\n    public function getTopPosts();\n    public function getUserPosts($userId);\n}<\/code><\/pre>\n<p><noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<p>\u042d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 Eloquent scopes, \u043d\u043e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0431\u044f\u0437\u0430\u043d\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u043e \u0432\u044b\u0431\u043e\u0440\u043a\u0435 \u0441\u0430\u043c\u0438\u0445 \u0441\u0435\u0431\u044f \u2014 \u043d\u0435 \u0441\u0430\u043c\u0430\u044f \u043b\u0443\u0447\u0448\u0430\u044f \u0437\u0430\u0442\u0435\u044f \u0438 \u0432\u044b\u043d\u043e\u0441 \u044d\u0442\u043e\u0439 \u043e\u0431\u044f\u0437\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u043a\u043b\u0430\u0441\u0441\u044b \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c. \u0422\u0430\u043a \u043b\u0438 \u044d\u0442\u043e? \u042f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b \u044d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438. \u041f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u0437\u0430\u043f\u0438\u0441\u0438. <\/p>\n<p><\/p>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u044d\u0442\u043e:<\/p>\n<p><\/p>\n<ul>\n<li>\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043e\u0431\u044c\u0435\u043a\u0442\u0430 \u0438 \u0432\u044b\u0437\u043e\u0432 <strong>PostRepository::save<\/strong><\/li>\n<li><strong>PostRepository::getById<\/strong>, \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u0432\u044b\u0437\u043e\u0432 <strong>PostRepository::save<\/strong><\/li>\n<li>\u0432\u044b\u0437\u043e\u0432 <strong>PostRepository::delete<\/strong><\/li>\n<\/ul>\n<p><\/p>\n<p>\u0412 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432\u044b\u0431\u043e\u0440\u043a\u0438. \u0412 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u0447\u0442\u0435\u043d\u0438\u044f \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u044b get*. \u0415\u0441\u043b\u0438 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e <strong>Interface Segregation Principle<\/strong> (\u0431\u0443\u043a\u0432\u0430 <strong>I<\/strong> \u0432 <strong>SOLID<\/strong>), \u0442\u043e \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043d\u0430\u0448 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u043c \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0434\u0432\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u0431\u044f\u0437\u0430\u043d\u043d\u043e\u0441\u0442\u0438. \u041f\u043e\u0440\u0430 \u0434\u0435\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u043d\u0430 \u0434\u0432\u0430. \u041c\u0435\u0442\u043e\u0434 <strong>getById<\/strong> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0432 \u043e\u0431\u043e\u0438\u0445, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0437\u043d\u044b\u043c\u0438. \u042d\u0442\u043e \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0434\u043d\u0435\u0435. \u041f\u0440\u043e \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u044c write-\u0447\u0430\u0441\u0442\u0438 \u044f \u043f\u0438\u0441\u0430\u043b \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u044d\u0442\u043e\u0439 \u044f \u043f\u0440\u043e \u043d\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0431\u0443\u0434\u0443. <\/p>\n<p><\/p>\n<p>Read \u0436\u0435 \u0447\u0430\u0441\u0442\u044c \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0443\u0436 \u0438 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0434\u0430\u0436\u0435 \u0434\u043b\u044f Eloquent \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439. \u041a\u0430\u043a \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441? \u041c\u043e\u0436\u043d\u043e <strong>ReadPostRepository<\/strong>, \u043d\u043e \u043a \u0448\u0430\u0431\u043b\u043e\u043d\u0443 <strong>Repository<\/strong> \u043e\u043d \u0443\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u043c\u0430\u043b\u043e\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435. \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e <strong>PostQueries<\/strong>:<\/p>\n<p><\/p>\n<pre><code class=\"php\">&lt;?php\ninterface PostQueries\n{\n    public function getById($id): Post;\n    public function getLastPosts();\n    public function getTopPosts();\n    public function getUserPosts($userId);\n}<\/code><\/pre>\n<p><\/p>\n<p>\u0415\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Eloquent \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430:<\/p>\n<p><\/p>\n<pre><code class=\"php\">&lt;?php\nfinal class EloquentPostQueries implements PostQueries\n{\n    public function getById($id): Post\n    {\n        return Post::findOrFail($id);\n    }\n\n    \/**\n    * @return Post[] | Collection\n    *\/\n    public function getLastPosts()\n    {\n        return Post::orderBy('created_at', 'desc')\n            -&gt;limit(\/*some limit*\/)\n            -&gt;get();\n    }\n    \/**\n    * @return Post[] | Collection\n    *\/\n    public function getTopPosts()\n    {\n        return Post::orderBy('rating', 'desc')\n            -&gt;limit(\/*some limit*\/)\n            -&gt;get();\n    }\n\n    \/**\n    * @param int $userId\n    * @return Post[] | Collection\n    *\/\n    public function getUserPosts($userId)\n    {\n        return Post::whereUserId($userId)\n            -&gt;orderBy('created_at', 'desc')\n            -&gt;get();\n    }\n}<\/code><\/pre>\n<p><\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0441\u0432\u044f\u0437\u0430\u043d \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432 <strong>AppServiceProvider<\/strong>:<\/p>\n<p><\/p>\n<pre><code class=\"php\">&lt;?php\nfinal class AppServiceProvider extends ServiceProvider \n{\n    public function register()\n    {\n        $this-&gt;app-&gt;bind(PostQueries::class, \n            EloquentPostQueries::class);\n    }\n}<\/code><\/pre>\n<p><\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0443\u0436\u0435 \u043f\u043e\u043b\u0435\u0437\u0435\u043d. \u041e\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0441\u0432\u043e\u044e \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u0440\u0430\u0437\u0433\u0440\u0443\u0437\u0438\u0432 \u044d\u0442\u0438\u043c \u043b\u0438\u0431\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b, \u043b\u0438\u0431\u043e \u043a\u043b\u0430\u0441\u0441 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438. \u0412 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0442\u0430\u043a:<\/p>\n<p><\/p>\n<pre><code class=\"php\">&lt;?php\nfinal class PostsController extends Controller\n{\n    public function lastPosts(PostQueries $postQueries)\n    {\n        return view('posts.last', [\n            'posts' =&gt; $postQueries-&gt;getLastPosts(),\n        ]);\n    }\n} <\/code><\/pre>\n<p><\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <strong>PostsController::lastPosts<\/strong> \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0441\u0438\u0442 \u0441\u0435\u0431\u0435 \u043a\u0430\u043a\u0443\u044e-\u043d\u0438\u0431\u0443\u0434\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e <strong>PostsQueries<\/strong> \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043d\u0435\u0439. \u0412 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0435 \u043c\u044b \u0441\u0432\u044f\u0437\u0430\u043b\u0438 <strong>PostQueries<\/strong> \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c <strong>EloquentPostQueries<\/strong> \u0438 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441.<\/p>\n<p><\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c. \u0422\u044b\u0441\u044f\u0447\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u043c\u0438\u043d\u0443\u0442\u0443 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c\u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f\u043c\u0438. \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0442\u043e\u0436\u0435 \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0447\u0430\u0441\u0442\u043e. \u0411\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u043a\u0435\u0448. \u041a\u0440\u043e\u043c\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u0435\u043a\u0438\u0439 \u0441\u043b\u0435\u043f\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043a \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c \u2014 <strong>memcached<\/strong> \u0438\u043b\u0438 <strong>redis<\/strong>.<\/p>\n<p><\/p>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435 \u0442\u0430\u043a\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u0430\u044f, \u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0435\u0435 \u0432 EloquentPostQueries \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e (\u0445\u043e\u0442\u044f \u0431\u044b \u0438\u0437-\u0437\u0430 <strong>Single Responsibility Principle<\/strong>). \u041d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u0435\u0435 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d <strong>\u0414\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440<\/strong> \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u043a \u0434\u0435\u043a\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f:<\/p>\n<p><\/p>\n<pre><code class=\"php\">&lt;?php\nuse IlluminateContractsCacheRepository;\n\nfinal class CachedPostQueries implements PostQueries\n{\n    const LASTS_DURATION = 10;\n\n    \/** @var PostQueries *\/\n    private $base;\n\n    \/** @var Repository *\/\n    private $cache;\n\n    public function __construct(\n        PostQueries $base, Repository $cache) \n    {\n        $this-&gt;base = $base;\n        $this-&gt;cache = $cache;\n    }\n\n    \/**\n    * @return Post[] | Collection\n    *\/\n    public function getLastPosts()\n    {\n        return $this-&gt;cache-&gt;remember('last_posts', \n            self::LASTS_DURATION, \n            function(){\n                return $this-&gt;base-&gt;getLastPosts();\n            });\n    }\n\n    \/\/ \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0442\u0430\u043a\u0438\u0435 \u0436\u0435\n}<\/code><\/pre>\n<p><\/p>\n<p>\u041d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0439\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <strong>Repository<\/strong> \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435. \u041f\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0442\u0430\u043a \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 Laravel.<\/p>\n<p><\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 <strong>CachedPostQueries<\/strong> \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. <strong>$this-&gt;cache-&gt;remember<\/strong> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0435\u0442 \u043b\u0438 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043a\u0435\u0448\u0435 \u0438 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 callback \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432 \u043a\u0435\u0448 \u0432\u0435\u0440\u043d\u0443\u0432\u0448\u0435\u0435\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043f\u0440\u043e\u0441\u044f\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 <strong>PostQueries<\/strong> \u0441\u0442\u0430\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 <strong>CachedPostQueries<\/strong>. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0430\u043c <strong>CachedPostQueries<\/strong> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0441 <strong>EloquentPostQueries<\/strong>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u0435\u0437 &#171;\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0439&#187; \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041c\u0435\u043d\u044f\u0435\u043c <strong>AppServiceProvider<\/strong>:<\/p>\n<p><\/p>\n<pre><code class=\"php\">&lt;?php\nfinal class AppServiceProvider extends ServiceProvider \n{\n    public function register()\n    {\n        $this-&gt;app-&gt;bind(PostQueries::class, \n            CachedPostQueries::class);\n\n        $this-&gt;app-&gt;when(CachedPostQueries::class)\n            -&gt;needs(PostQueries::class)\n            -&gt;give(EloquentPostQueries::class);\n    }\n}<\/code><\/pre>\n<p><\/p>\n<p>\u0412\u0441\u0435 \u043c\u043e\u0438 \u043f\u043e\u0436\u0435\u043b\u0430\u043d\u0438\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0435. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0432 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441 \u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. \u041a\u043e\u0434 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0441\u044f.<\/p>\n<p><\/p>\n<p>\u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0435\u0449\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e, \u0447\u0442\u043e\u0431\u044b \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u0432\u0438\u0441\u0435\u043b\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u0435\u0449\u0435 \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0430 \u0443\u0434\u0430\u043b\u0438\u043b\u0430\u0441\u044c \u0441\u0440\u0430\u0437\u0443. \u041d\u043e \u044d\u0442\u043e \u0443\u0436\u0435 \u043c\u0435\u043b\u043e\u0447\u0438.<\/p>\n<p><\/p>\n<p>\u0418\u0442\u043e\u0433: \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043d\u0435 \u043e\u0434\u0438\u043d, \u0430 \u0446\u0435\u043b\u044b\u0445 \u0434\u0432\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430. \u0428\u0430\u0431\u043b\u043e\u043d <strong>Command Query Responsibility Segregation (CQRS)<\/strong> \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u0432. \u042f \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u043d\u0435\u043c\u0443 \u0447\u0435\u0440\u0435\u0437 <strong>Interface Segregation Principle<\/strong>, \u0447\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u044f \u0443\u043c\u0435\u043b\u043e \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u0443\u044e \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438 \u0438 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430\u043c\u0438 \u0438 \u0432\u044b\u0432\u043e\u0436\u0443 \u043e\u0434\u0438\u043d \u0438\u0437 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043a\u0430\u043a \u0442\u0435\u043e\u0440\u0435\u043c\u0443 \ud83d\ude42 \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043d\u0435 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0442\u0430\u043a\u0430\u044f \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u043d\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u043d\u043e \u044f \u043f\u043e\u0434\u0435\u043b\u044e\u0441\u044c \u0441 \u0432\u0430\u043c\u0438 \u0444\u043e\u043a\u0443\u0441\u043e\u043c.\u041d\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 <strong>PostQueries<\/strong> \u0441 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 Eloquent:<\/p>\n<p><\/p>\n<pre><code class=\"php\">&lt;?php\nfinal class PostQueries\n{\n    public function getById($id): Post\n    {\n        return Post::findOrFail($id);\n    }\n\n    \/\/ \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b\n}<\/code><\/pre>\n<p><\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432 \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438, \u043b\u0435\u0433\u043a\u0438\u043c \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 (\u0438\u043b\u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441) \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 <strong>PostQueries<\/strong>, \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u043b\u0430\u0441\u0441 <strong>EloquentPostQueries<\/strong> \u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0441\u0445\u0435\u043c\u0435, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u043c\u043d\u043e\u044e \u0440\u0430\u043d\u0435\u0435. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e.<\/p>\n<p><\/p>\n<p>\u0412\u0441\u0435 \u044d\u0442\u0438 \u0444\u043e\u043a\u0443\u0441\u044b \u0441 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u043c\u0438, <strong>Dependency Injection<\/strong> \u0438 <strong>CQRS<\/strong> \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 <noindex><a rel=\"nofollow\" href=\"https:\/\/adelf.tech\/2019\/architecture-of-complex-web-applications\">\u043c\u043e\u0435\u0439 \u043a\u043d\u0438\u0433\u0435 &#171;\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0432\u0435\u0431 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439&#187;<\/a><\/noindex>. \u0422\u0430\u043c \u0436\u0435 \u0440\u0430\u0437\u0433\u0430\u0434\u043a\u0430 \u0437\u0430\u0433\u0430\u0434\u043a\u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u0432\u0441\u0435 \u043c\u043e\u0438 \u043a\u043b\u0430\u0441\u0441\u044b \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043a \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u043a\u0430\u043a final.<\/p>\n<p>\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/445452\/\">habr.com<\/a><\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u041d\u0430 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043e \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0434\u043b\u044f Eloquent \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043e\u0431\u0435\u0449\u0430\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u044d\u0442\u043e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f: &lt;?php interface PostRepository { public function getById($id): Post; public function save(Post $post); public function delete($id); [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[702],"tags":[],"class_list":["post-30376","post","type-post","status-publish","format-standard","hentry","category-novosti-interneta"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041d\u0430 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043e \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0434\u043b\u044f Eloquent \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043e\u0431\u0435\u0449\u0430\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u044d\u0442\u043e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f:\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/de\/blog\/novosti-interneta\/poleznye-repozitorii-s-eloquent\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"de_DE\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0441 Eloquent? | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041d\u0430 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043e \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0434\u043b\u044f Eloquent \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043e\u0431\u0435\u0449\u0430\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u044d\u0442\u043e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f:\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/de\/blog\/novosti-interneta\/poleznye-repozitorii-s-eloquent\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T18:35:14+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T18:35:14+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47N\u00fctzliche Repositories mit Eloquent? | ProHoster","description":"Letzte Woche habe ich einen Artikel \u00fcber die Nutzlosigkeit des Repository-Musters f\u00fcr Eloquent-Entities geschrieben, allerdings habe ich versprochen, zu erkl\u00e4ren, wie man es teilweise sinnvoll nutzen kann. Dazu versuche ich zu analysieren, wie dieses Muster \u00fcblicherweise in Projekten verwendet wird. Der minimal notwendige Satz von Methoden f\u00fcr ein Repository:","canonical_url":"https:\/\/prohoster.info\/de\/blog\/novosti-interneta\/poleznye-repozitorii-s-eloquent","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"de_DE","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0441 Eloquent? | ProHoster","og:description":"\u041d\u0430 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043d\u0435\u0434\u0435\u043b\u0435 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043e \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0441\u0442\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0434\u043b\u044f Eloquent \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u043e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u043e\u0431\u0435\u0449\u0430\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u044d\u0442\u043e\u0442 \u0448\u0430\u0431\u043b\u043e\u043d \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445. \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f:","og:url":"https:\/\/prohoster.info\/de\/blog\/novosti-interneta\/poleznye-repozitorii-s-eloquent","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T18:35:14+00:00","article:modified_time":"2019-10-31T18:35:14+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"30376","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-21 00:55:21","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 03:36:22","updated":"2026-01-21 00:55:21"},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/posts\/30376","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/comments?post=30376"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/posts\/30376\/revisions"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/media?parent=30376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/categories?post=30376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/de\/wp-json\/wp\/v2\/tags?post=30376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}