{"id":29084,"date":"2021-06-02T19:11:00","date_gmt":"2021-06-02T16:11:00","guid":{"rendered":"https:\/\/themewp.inform.click\/?p=29084"},"modified":"2025-02-12T05:51:39","modified_gmt":"2025-02-12T02:51:39","slug":"jak-vikonuvati-visiv-bazi-danih-u-laravel","status":"publish","type":"post","link":"https:\/\/themewp.inform.click\/uk\/jak-vikonuvati-visiv-bazi-danih-u-laravel\/","title":{"rendered":"\u042f\u043a \u0432\u0438\u043a\u043e\u043d\u0443\u0432\u0430\u0442\u0438 \u0432\u0438\u0441\u0456\u0432 \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u0443 Laravel"},"content":{"rendered":"<p>\u0420\u0430\u043d\u0456\u0448\u0435 \u044f \u043e\u043f\u0443\u0431\u043b\u0456\u043a\u0443\u0432\u0430\u0432 \u0441\u0442\u0430\u0442\u0442\u044e <a href=\"https:\/\/themewp.inform.click\/uk\/jak-zasijati-bazu-danih-za-dopomogoju-php-faker-library\/\" title=\"\u042f\u043a \u0437\u0430\u0440\u043e\u0431\u0438\u0442\u0438 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u0438\u0445 \u0443 PHP \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u0431\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0438 Faker\" >\u042f\u043a \u0437\u0430\u0440\u043e\u0431\u0438\u0442\u0438 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u0438\u0445 \u0443 PHP \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u0431\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0438 Faker<\/a>. \u0414\u043e\u0441\u043b\u0456\u0434\u0436\u0443\u044e\u0447\u0438 \u0446\u044e \u0442\u0435\u043c\u0443, \u044f \u0432\u0438\u044f\u0432\u0438\u0432, \u0449\u043e Laravel \u0442\u0430\u043a\u043e\u0436 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0454 \u0442\u0443 \u0441\u0430\u043c\u0443 \u0431\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0437\u0430\u0441\u043d\u0443\u0432\u0430\u043d\u043d\u044f \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445. \u041e\u0441\u043a\u0456\u043b\u044c\u043a\u0438 \u044f \u043f\u0438\u0441\u0430\u0432 \u0441\u0442\u0430\u0442\u0442\u044e \u043d\u0430 \u0446\u044e \u0442\u0435\u043c\u0443 \u0434\u043b\u044f PHP, \u044f \u0432\u0438\u0440\u0456\u0448\u0438\u0432 \u0442\u0430\u043a\u043e\u0436 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u0438 \u0434\u043e\u043f\u0438\u0441 \u043f\u0440\u043e \u0437\u0430\u043f\u0443\u0441\u043a \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 Laravel. \u0426\u0435 \u043f\u043e\u0432&#8217;\u044f\u0437\u0430\u043d\u043e \u0437 \u0442\u0438\u043c, \u0449\u043e Laravel \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0454 \u0432\u043b\u0430\u0441\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441 \u0434\u043b\u044f \u0437\u0430\u0441\u0456\u0432\u0430\u043d\u043d\u044f \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445.<\/p>\n<h3>\u0429\u043e \u0442\u0430\u043a\u0435 \u043d\u0430\u0441\u0456\u043d\u043d\u044f \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445?<\/h3>\n<p>\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u043e\u0437\u043d\u0430\u0447\u0430\u0454 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043d\u0435 \u0437\u0430\u043f\u043e\u0432\u043d\u0435\u043d\u043d\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044c \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u0442\u0435\u0441\u0442\u043e\u0432\u0438\u043c\u0438 \u0434\u0430\u043d\u0438\u043c\u0438. \u0417\u0430 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0456\u0434\u0445\u043e\u0434\u0443 \u043c\u043e\u0436\u043d\u0430 \u0432\u0432\u0435\u0441\u0442\u0438 \u0442\u0438\u0441\u044f\u0447\u0456 \u0437\u0430\u043f\u0438\u0441\u0456\u0432 \u0434\u043e \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u043f\u0440\u043e\u0442\u044f\u0433\u043e\u043c \u0434\u0435\u043a\u0456\u043b\u044c\u043a\u043e\u0445 \u0445\u0432\u0438\u043b\u0438\u043d. \u0426\u0435 \u0435\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0438\u0439 \u0441\u043f\u043e\u0441\u0456\u0431, \u0430 \u043d\u0435 \u0440\u043e\u0431\u0438\u0442\u0438 \u0446\u0435 \u0432\u0440\u0443\u0447\u043d\u0443. \u041c\u043e\u0436\u043b\u0438\u0432\u043e, \u0432\u0430\u043c \u0437\u043d\u0430\u0434\u043e\u0431\u043b\u044f\u0442\u044c\u0441\u044f \u0444\u0456\u043a\u0442\u0438\u0432\u043d\u0456 \u0434\u0430\u043d\u0456 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0443\u0432\u0430\u043d\u043d\u044f \u0432\u0430\u0448\u043e\u0457 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u0438, \u0430 \u0440\u043e\u0437\u043f\u043e\u0432\u0441\u044e\u0434\u0436\u0435\u043d\u043d\u044f \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u0438 \u0435\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043a\u0443\u043f\u0443 \u0447\u0430\u0441\u0443.<\/p>\n<h3>\u0411\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0430 Faker<\/h3>\n<p><a href=\"https:\/\/github.com\/fzaninotto\/Faker\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">Faker<\/a> &#8211; \u0446\u0435 \u0431\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0430 \u0437 \u0432\u0456\u0434\u043a\u0440\u0438\u0442\u0438\u043c \u043a\u043e\u0434\u043e\u043c, \u044f\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0443\u0454 \u043f\u0456\u0434\u0440\u043e\u0431\u043b\u0435\u043d\u0456 \u0434\u0430\u043d\u0456 \u0434\u043b\u044f \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u0432\u0430\u0448\u043e\u0457 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u0438. \u0417\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e Faker \u043c\u043e\u0436\u043d\u0430 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u0442\u0438\u0441\u044f\u0447\u0456 \u0437\u0430\u043f\u0438\u0441\u0456\u0432 \u0443 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u0438\u0445 \u0437\u0430 \u043f\u0430\u0440\u0443 \u0445\u0432\u0438\u043b\u0438\u043d. \u0426\u044f \u0431\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0430 \u0437\u0431\u0435\u0440\u0456\u0433\u0430\u0454 \u043d\u0443\u0434\u043d\u0435 \u0437\u0430\u0432\u0434\u0430\u043d\u043d\u044f \u0432\u0432\u0435\u0434\u0435\u043d\u043d\u044f \u0434\u0430\u043d\u0438\u0445 \u0434\u043b\u044f \u0440\u043e\u0437\u0440\u043e\u0431\u043d\u0438\u043a\u0456\u0432. \u0412\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0442\u0440\u0438\u043c\u0430\u0442\u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u043e \u0431\u0443\u0434\u044c-\u044f\u043a\u0438\u0439 \u0442\u0438\u043f \u0434\u0430\u043d\u0438\u0445, \u044f\u043a\u0438\u0439 \u0445\u043e\u0447\u0435\u0442\u0435. \u0411\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0443\u0454 \u0444\u0430\u043b\u044c\u0448\u0438\u0432\u0438\u0439 \u0435\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0438\u0439 \u043b\u0438\u0441\u0442, \u0456\u043c\u2019\u044f, \u043d\u043e\u043c\u0435\u0440 \u043c\u043e\u0431\u0456\u043b\u044c\u043d\u043e\u0433\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0443, \u0441\u043b\u043e\u0432\u0430, \u0440\u0435\u0447\u0435\u043d\u043d\u044f, \u0430\u0431\u0437\u0430\u0446\u0438, \u0432\u0438\u043f\u0430\u0434\u043a\u043e\u0432\u0456 \u0447\u0438\u0441\u043b\u0430 \u0442\u043e\u0449\u043e. \u0412\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u0438 \u0434\u0430\u043d\u0456, \u044f\u043a\u0456 \u0432\u043e\u043d\u0438 \u043d\u0430\u0434\u0430\u044e\u0442\u044c \u0443 <a href=\"https:\/\/github.com\/fzaninotto\/Faker\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0456\u0457<\/a>.<\/p>\n<p>Laravel \u0432\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e\u0454 \u0446\u044e \u0431\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0443 \u043f\u043e \u0441\u0443\u0442\u0456. \u0426\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0454, \u0449\u043e \u0432\u0430\u043c \u043d\u0435 \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0432\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e\u0432\u0430\u0442\u0438 \u0439\u043e\u0433\u043e \u043e\u043a\u0440\u0435\u043c\u043e. \u0417 \u043e\u0433\u043b\u044f\u0434\u0443 \u043d\u0430 \u0446\u0435, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0438\u0432\u0438\u043c\u043e\u0441\u044f, \u044f\u043a \u0432\u0438\u043a\u043e\u043d\u0443\u0432\u0430\u0442\u0438 \u0432\u0438\u0441\u0456\u0432 \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u0443 Laravel.<\/p>\n<h3>\u041f\u043e\u0447\u0438\u043d\u0430\u0454\u043c\u043e<\/h3>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0449\u043e\u0431 \u0440\u043e\u0437\u043f\u043e\u0447\u0430\u0442\u0438, \u044f \u0437\u0431\u0438\u0440\u0430\u044e\u0441\u044f \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044e &quot;\u043a\u043b\u0456\u0454\u043d\u0442\u0456\u0432&quot; \u0456\u0437 \u043d\u0430\u0437\u0432\u043e\u044e \u0441\u0442\u043e\u0432\u043f\u0446\u0456\u0432, \u0435\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u044e \u043f\u043e\u0448\u0442\u043e\u044e \u0442\u0430 \u0431\u0456\u043e\u0433\u0440\u0430\u0444\u0456\u0454\u044e. \u041c\u0438 \u043f\u043e\u0431\u0430\u0447\u0438\u043c\u043e \u043f\u0440\u043e\u0446\u0435\u0441 \u0432\u0438\u0441\u0456\u0432\u0430\u043d\u043d\u044f \u0454\u0434\u0438\u043d\u043e\u0433\u043e \u0441\u0442\u043e\u043b\u0443. \u0422\u0430\u043a\u0438\u043c \u0436\u0435 \u0447\u0438\u043d\u043e\u043c \u043a\u043e\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447\u0456 \u043c\u043e\u0436\u0443\u0442\u044c \u043d\u0430\u0434\u0430\u0442\u0438 \u0441\u0442\u0456\u043b\u044c\u043a\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044c, \u0441\u043a\u0456\u043b\u044c\u043a\u0438 \u0445\u043e\u0447\u0443\u0442\u044c.<\/p>\n<p>\u0421\u0442\u0432\u043e\u0440\u0456\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044e \u043c\u0456\u0433\u0440\u0430\u0446\u0456\u0457 \u0434\u043b\u044f \u043a\u043b\u0456\u0454\u043d\u0442\u0456\u0432 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0438:<\/p>\n<pre><code>php artisan make:migration create_customers_table<\/code><\/pre>\n<p>\u0412\u0456\u0434\u043a\u0440\u0438\u0439\u0442\u0435 \u0444\u0430\u0439\u043b \u043c\u0456\u0433\u0440\u0430\u0446\u0456\u0457 \u0442\u0430 \u0434\u043e\u0434\u0430\u0439\u0442\u0435 \u0441\u0442\u043e\u0432\u043f\u0446\u0456 \u0434\u043e \u043c\u0435\u0442\u043e\u0434\u0443 &#8216;\u0432\u0433\u043e\u0440\u0443&#8217;, \u044f\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0447\u0435.<\/p>\n<pre><code>public function up()\n{\n\u00a0\u00a0\u00a0\u00a0Schema::create('customers', function (Blueprint $table) {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$table-&gt;id();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$table-&gt;string('name');\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$table-&gt;string('email');\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$table-&gt;text('bio');\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$table-&gt;timestamps();\n\u00a0\u00a0\u00a0\u00a0});\n}<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0456\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 migrate, \u044f\u043a\u0430 \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044e &quot;\u043a\u043b\u0456\u0454\u043d\u0442\u0456\u0432&quot; \u0443 \u0432\u0430\u0448\u0456\u0439 \u0431\u0430\u0437\u0456 \u0434\u0430\u043d\u0438\u0445.<\/p>\n<pre><code>php artisan migrate<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0456 \u0441\u0442\u0432\u043e\u0440\u0456\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c &quot;\u041a\u043b\u0456\u0454\u043d\u0442&quot;, \u044f\u043a\u0430 \u0432\u0456\u0434\u043e\u0431\u0440\u0430\u0436\u0430\u0454\u0442\u044c\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0456 &quot;\u041a\u043b\u0456\u0454\u043d\u0442\u0438&quot;. \u041f\u043e\u0447\u0438\u043d\u0430\u044e\u0447\u0438 \u0437 Laravel 8.x, \u0432\u0430\u0448\u0456 \u043c\u043e\u0434\u0435\u043b\u0456 \u0441\u0442\u0432\u043e\u0440\u044e\u0432\u0430\u0442\u0438\u043c\u0443\u0442\u044c\u0441\u044f \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0437\u0456 &quot;\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u0438 \/ \u041c\u043e\u0434\u0435\u043b\u0456&quot;. \u0414\u043b\u044f \u0446\u044c\u043e\u0433\u043e \u043f\u0456\u0434\u0440\u0443\u0447\u043d\u0438\u043a\u0430 \u044f \u043f\u0440\u0438\u043f\u0443\u0441\u043a\u0430\u044e, \u0449\u043e \u0432\u0438 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0454\u0442\u0435 Laravel 8.x. \u0423 \u043f\u043e\u043f\u0435\u0440\u0435\u0434\u043d\u0456\u0439 \u0432\u0435\u0440\u0441\u0456\u0457 Laravel \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u0442\u0438 \u0448\u043b\u044f\u0445 \u0434\u043e \u043c\u043e\u0434\u0435\u043b\u0456.<\/p>\n<pre><code>php artisan make:model Customer<\/code><\/pre>\n<h3>\u041d\u0430\u0441\u0456\u043d\u043d\u044f \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u0443 Laravel<\/h3>\n<p>\u041f\u043e\u0441\u0456\u0432 \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u0443 Laravel \u0432\u0438\u043c\u0430\u0433\u0430\u0454, \u0449\u043e\u0431 \u0432\u0438 \u0432\u0438\u043a\u043e\u043d\u0430\u043b\u0438 \u043a\u0456\u043b\u044c\u043a\u0430 \u043a\u0440\u043e\u043a\u0456\u0432, \u044f\u043a\u0456 \u0441\u0442\u043e\u0441\u0443\u044e\u0442\u044c\u0441\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044f \u0441\u0456\u0432\u0430\u043b\u043e\u043a, \u0441\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f \u043c\u043e\u0434\u0435\u043b\u044c\u043d\u043e\u0457 \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u0442\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u0441\u0456\u0432\u0430\u043b\u043e\u043a. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u043e\u0431\u0438\u0442\u0438 \u0446\u0435 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443.<\/p>\n<h4>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044f \u0441\u0456\u0432\u0430\u043b\u043e\u043a<\/h4>\n<p>\u042f\u043a\u0449\u043e \u0432\u0438 \u043f\u043e\u0434\u0438\u0432\u0438\u0442\u0435\u0441\u044c \u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 Laravel, \u0442\u043e \u043f\u043e\u043c\u0456\u0442\u0438\u0442\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <code>database\/seeders<\/code>. \u0423\u0441\u0456 \u043a\u043b\u0430\u0441\u0438 \u043d\u0430\u0441\u0456\u043d\u043d\u044f \u0431\u0443\u0434\u0443\u0442\u044c \u0437\u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0438\u0441\u044f \u0432\u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0456 \u0446\u044c\u043e\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443. \u041a\u043b\u0430\u0441 \u043d\u0430\u0441\u0456\u043d\u043d\u044f \u043c\u0430\u0454 <code>run<\/code>\u043c\u0435\u0442\u043e\u0434, \u0437\u0432\u0456\u0434\u043a\u0438 \u0432\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u0438 \u0434\u0430\u043d\u0456 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044e.<\/p>\n<p>\u0421\u0442\u0432\u043e\u0440\u0456\u0442\u044c \u043d\u0430\u0441\u0456\u043d\u043d\u0454\u0432\u0438\u0439 \u043a\u043b\u0430\u0441 CustomerSeeder, \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u044e\u0447\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<pre><code>php artisan make:seeder CustomerSeeder<\/code><\/pre>\n<p>\u041f\u0456\u0441\u043b\u044f \u0432\u0438\u043a\u043e\u043d\u0430\u043d\u043d\u044f \u0446\u0456\u0454\u0457 \u043a\u043e\u043c\u0430\u043d\u0434\u0438 \u0432\u0438 \u043f\u043e\u0431\u0430\u0447\u0438\u0442\u0435 <code>CustomerSeeder.php<\/code>\u0444\u0430\u0439\u043b, \u0441\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u0439 \u043f\u0456\u0434 <code>database\/seeders<\/code>. \u0412\u0456\u0434\u043a\u0440\u0438\u0439\u0442\u0435 \u0446\u0435\u0439 \u0444\u0430\u0439\u043b \u0456 <code>run<\/code>\u0434\u043e\u0434\u0430\u0439\u0442\u0435 \u0434\u043e \u0444\u0443\u043d\u043a\u0446\u0456\u0457 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0438\u0439 \u043a\u043e\u0434.<\/p>\n<pre><code>public function run()\n{\n\u00a0\u00a0\u00a0\u00a0AppModelsCustomer::factory()-&gt;count(50)-&gt;create()-&gt;each(function ($customer) {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$customer-&gt;save();\n\u00a0\u00a0\u00a0\u00a0});\n}<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u044f \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0443\u044e \u0434\u043e \u0444\u0430\u0431\u0440\u0438\u043a\u0438 \u0437\u0430\u043c\u043e\u0432\u043d\u0438\u043a\u0430, \u044f\u043a\u0443 \u043c\u0438 \u0441\u0442\u0432\u043e\u0440\u0438\u043c\u043e \u043d\u0430 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u043e\u043c\u0443 \u043a\u0440\u043e\u0446\u0456. \u0417\u0432\u0435\u0440\u043d\u0456\u0442\u044c \u0443\u0432\u0430\u0433\u0443, \u0449\u043e \u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f \u044f\u043a 50 \u043c\u0435\u0442\u043e\u0434\u0443 &#8216;count&#8217;. \u0426\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0454, \u0449\u043e \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u044e &quot;\u043a\u043b\u0456\u0454\u043d\u0442\u0456\u0432&quot; \u0441\u043b\u0456\u0434 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u0438 50 \u0440\u044f\u0434\u043a\u0456\u0432. \u0412\u0456\u0434\u0440\u0435\u0433\u0443\u043b\u044e\u0439\u0442\u0435 \u0446\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f \u044f\u043a \u0437\u0430\u0432\u0433\u043e\u0434\u043d\u043e.<\/p>\n<h4>\u0421\u0442\u0432\u043e\u0440\u0435\u043d\u043d\u044f \u0444\u0430\u0431\u0440\u0438\u043a<\/h4>\n<p>\u041a\u043e\u0434, \u044f\u043a\u0438\u0439 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0432, <code>CustomerSeeder<\/code>\u0431\u0443\u0434\u0435 \u0448\u0443\u043a\u0430\u0442\u0438 \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0434\u043b\u044f \u043e\u0442\u0440\u0438\u043c\u0430\u043d\u043d\u044f \u0434\u0430\u043d\u0438\u0445 \u0442\u0435\u0441\u0442\u0443. \u0426\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0454, \u0449\u043e \u043c\u0438 \u043f\u043e\u0432\u0438\u043d\u043d\u0456 \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u044c\u043d\u0443 \u0444\u0430\u0431\u0440\u0438\u043a\u0443. \u042f \u0434\u0430\u043c \u0444\u0430\u0431\u0440\u0438\u0446\u0456 \u043d\u0430\u0437\u0432\u0443 CustomerFactory. \u0417\u0430\u043f\u0443\u0441\u0442\u0456\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0449\u043e\u0431 \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/p>\n<pre><code>php artisan make:factory CustomerFactory --model=Customer<\/code><\/pre>\n<p>\u0426\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u044c <code>CustomerFactory.php<\/code>\u0443\u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0456 <code>database\/factories<\/code>\u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443. \u0412\u0456\u0434\u043a\u0440\u0438\u0439\u0442\u0435 \u0446\u0435\u0439 \u0444\u0430\u0439\u043b \u0456 \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u0443 \u0432\u0438\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f \u0437\u0433\u0435\u043d\u0435\u0440\u0443\u0439\u0442\u0435 \u0434\u0430\u043d\u0456 \u0442\u0435\u0441\u0442\u0443 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0438\u043c \u0447\u0438\u043d\u043e\u043c.<\/p>\n<pre><code>public function definition()\n{\n\u00a0\u00a0\u00a0\u00a0return [\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'name' =&gt; $this-&gt;faker-&gt;name,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'email' =&gt; $this-&gt;faker-&gt;unique()-&gt;safeEmail,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'bio' =&gt; $this-&gt;faker-&gt;text,\n\u00a0\u00a0\u00a0\u00a0];\n}<\/code><\/pre>\n<p>\u041d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0439 \u0432\u0438\u0449\u0435 \u043c\u0430\u0441\u0438\u0432 \u043f\u043e\u0432\u0435\u0440\u0442\u0430\u0454 \u0432\u0438\u043f\u0430\u0434\u043a\u043e\u0432\u043e \u0432\u0438\u0431\u0440\u0430\u043d\u0435 \u0456\u043c\u2019\u044f, \u0435\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0443 \u0430\u0434\u0440\u0435\u0441\u0443 \u0442\u0430 \u0442\u0435\u043a\u0441\u0442 \u0434\u043b\u044f \u0431\u0456\u043e\u0433\u0440\u0430\u0444\u0456\u0457.<\/p>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a \u0441\u0456\u0432\u0430\u043b\u043e\u043a<\/h4>\n<p>\u041c\u0438 \u0432\u0441\u0435 \u043d\u0430\u043b\u0430\u0448\u0442\u0443\u0432\u0430\u043b\u0438 \u0456\u0437 \u0441\u0456\u0432\u0430\u043b\u043a\u043e\u044e \u0442\u0430 \u0437\u0430\u0432\u043e\u0434\u043e\u043c. \u0422\u0435\u043f\u0435\u0440 \u0437\u0430\u043f\u0443\u0441\u0442\u0456\u0442\u044c \u043d\u0430\u0448\u0443 \u0441\u0456\u0432\u0430\u043b\u043a\u0443, \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u044e\u0447\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0438\u0436\u0447\u0435.<\/p>\n<pre><code>php artisan db:seed --class=CustomerSeeder<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0432\u0456\u0440\u0442\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044e \u0441\u0432\u043e\u0457\u0445 \u043a\u043b\u0456\u0454\u043d\u0442\u0456\u0432, \u0456 \u0432\u043e\u043d\u0430 \u043f\u043e\u0432\u0438\u043d\u043d\u0430 \u043c\u0430\u0442\u0438 50 \u0444\u0456\u043a\u0442\u0438\u0432\u043d\u0438\u0445 \u0437\u0430\u043f\u0438\u0441\u0456\u0432.<\/p>\n<p>\u0412\u0438\u0449\u0435\u0432\u043a\u0430\u0437\u0430\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0454 \u0454\u0434\u0438\u043d\u0438\u0439 \u0441\u0456\u044f\u043b\u044c\u043d\u0438\u043a, \u044f\u043a\u0438\u0439 \u043c\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043b\u0438 \u044f\u0432\u043d\u043e. \u0421\u043a\u0430\u0436\u0456\u043c\u043e, \u0432\u0438 \u0445\u043e\u0447\u0435\u0442\u0435 \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u043a\u0456\u043b\u044c\u043a\u0430 \u0441\u0456\u044f\u043b\u043e\u043a \u0456 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0438 \u0432\u0441\u0456 \u0437 \u043d\u0438\u0445 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u043e\u0434\u043d\u0456\u0454\u0457 \u043a\u043e\u043c\u0430\u043d\u0434\u0438. \u0423 \u0442\u0430\u043a\u0438\u0445 \u0432\u0438\u043f\u0430\u0434\u043a\u0430\u0445 \u0432\u0430\u043c \u0441\u043b\u0456\u0434 \u0437\u0430\u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0443\u0432\u0430\u0442\u0438 \u0434\u043e \u0441\u0456\u0432\u0430\u043b\u043e\u043a, <code>DatabaseSeeder<\/code>\u044f\u043a\u0456 \u0437\u043d\u0430\u0445\u043e\u0434\u044f\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c\u0443 \u0436 \u043a\u0430\u0442\u0430\u043b\u043e\u0437\u0456 <code>database\/seeders<\/code>.<\/p>\n<pre><code>public function run()\n\u00a0\u00a0\u00a0\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$this-&gt;call(CustomerSeeder::class);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\/\/ call as many seeders you wish\n\u00a0\u00a0\u00a0\u00a0}<\/code><\/pre>\n<p>\u041a\u043e\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0447 \u043c\u043e\u0436\u0435 \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u0441\u0442\u0456\u043b\u044c\u043a\u0438 \u0441\u0456\u0432\u0430\u043b\u043e\u043a \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u043d\u043e \u0434\u043e \u0457\u0445 \u0432\u0438\u043c\u043e\u0433 \u0456 \u0432\u0438\u043a\u043b\u0438\u043a\u0430\u0442\u0438 \u0457\u0445 \u0437\u0430 \u0434\u043e\u043f\u043e\u043c\u043e\u0433\u043e\u044e \u0446\u044c\u043e\u0433\u043e <code>run<\/code>\u043c\u0435\u0442\u043e\u0434\u0443.<\/p>\n<p>\u041d\u0430\u0440\u0435\u0448\u0442\u0456, \u0437\u0430\u043f\u0443\u0441\u0442\u0456\u0442\u044c \u0441\u0456\u0432\u0430\u043b\u043a\u0438, \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u044e\u0447\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0438\u0436\u0447\u0435.<\/p>\n<pre><code>php artisan db:seed<\/code><\/pre>\n<p>\u0412\u0456\u043d \u0432\u0438\u043a\u043b\u0438\u0447\u0435 \u0432\u0441\u0456 \u0441\u0456\u0432\u0430\u043b\u043a\u0438 \u0437 <code>run<\/code>\u043c\u0435\u0442\u043e\u0434\u0443 \u0456 \u0432\u0438\u043a\u043e\u043d\u0430\u0454 \u0439\u043e\u0433\u043e.<\/p>\n<p>\u0421\u043f\u043e\u0434\u0456\u0432\u0430\u044e\u0441\u044f, \u0432\u0438 \u0440\u043e\u0437\u0443\u043c\u0456\u0454\u0442\u0435 \u043f\u0440\u043e \u0437\u0430\u0441\u0456\u0432\u0430\u043d\u043d\u044f \u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445 \u0443 Laravel. \u042f \u0445\u043e\u0442\u0456\u0432 \u0431\u0438 \u043f\u043e\u0447\u0443\u0442\u0438 \u0432\u0430\u0448\u0456 \u0434\u0443\u043c\u043a\u0438 \u0442\u0430 \u043f\u0440\u043e\u043f\u043e\u0437\u0438\u0446\u0456\u0457 \u0443 \u0440\u043e\u0437\u0434\u0456\u043b\u0456 \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u0456\u0432 \u043d\u0438\u0436\u0447\u0435.<\/p>\n<h4>\u041f\u043e\u0432\u2019\u044f\u0437\u0430\u043d\u0456 \u0441\u0442\u0430\u0442\u0442\u0456<\/h4>\n<ul>\n<li><a href=\"https:\/\/themewp.inform.click\/uk\/integracija-paypal-payments-pro-v-laravel\/\" title=\"\u0406\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0456\u044f PayPal Payments Pro \u0432 Laravel\">\u0406\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0456\u044f PayPal Payments Pro \u0432 Laravel<\/a><\/li>\n<li><a href=\"https:\/\/themewp.inform.click\/uk\/jak-stvoriti-honeypot-dlja-borotbi-zi-spamom-u-laravel\/\" title=\"\u0421\u0442\u0432\u043e\u0440\u0456\u0442\u044c Honeypot \u0434\u043b\u044f \u0431\u043e\u0440\u043e\u0442\u044c\u0431\u0438 \u0437\u0456 \u0441\u043f\u0430\u043c\u043e\u043c \u0443 Laravel\">\u0421\u0442\u0432\u043e\u0440\u0456\u0442\u044c Honeypot \u0434\u043b\u044f \u0431\u043e\u0440\u043e\u0442\u044c\u0431\u0438 \u0437\u0456 \u0441\u043f\u0430\u043c\u043e\u043c \u0443 Laravel<\/a><\/li>\n<li><a href=\"https:\/\/themewp.inform.click\/uk\/posibnyk-z-dodavannia-google-recaptcha-v3-do-vashoho-veb-sajtu-laravel\/\" title=\"\u0414\u043e\u0434\u0430\u0432\u0430\u043d\u043d\u044f Google reCAPTCHA v3 \u0434\u043e \u0432\u0430\u0448\u043e\u0433\u043e \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0443 Laravel\">\u0414\u043e\u0434\u0430\u0432\u0430\u043d\u043d\u044f Google reCAPTCHA v3 \u0434\u043e \u0432\u0430\u0448\u043e\u0433\u043e \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0443 Laravel<\/a><\/li>\n<\/ul>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0414\u0436\u0435\u0440\u0435\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0443: artisansweb.net<\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0428\u0443\u043a\u0430\u0454\u0442\u0435 \u043f\u043e\u0441\u0456\u0432 \u0431\u0430\u0437 \u0434\u0430\u043d\u0438\u0445 \u0443 Laravel? \u0423 \u0446\u0456\u0439 \u0441\u0442\u0430\u0442\u0442\u0456 \u044f \u043f\u043e\u043a\u0430\u0436\u0443, \u044f\u043a \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u0442\u0430 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0438 \u043f\u043e\u0441\u0456\u0432 \u0443 \u0434\u043e\u0434\u0430\u0442\u043a\u0443 Laravel. \u0411\u0456\u0431\u043b\u0456\u043e\u0442\u0435\u043a\u0430 Faker<\/p>\n","protected":false},"author":1,"featured_media":21644,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[504],"tags":[851],"class_list":["post-29084","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel","tag-affiai-uk"],"_links":{"self":[{"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/posts\/29084","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/comments?post=29084"}],"version-history":[{"count":1,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/posts\/29084\/revisions"}],"predecessor-version":[{"id":513409,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/posts\/29084\/revisions\/513409"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/media\/21644"}],"wp:attachment":[{"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/media?parent=29084"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/categories?post=29084"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/themewp.inform.click\/uk\/wp-json\/wp\/v2\/tags?post=29084"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}