{"id":339921,"date":"2022-10-18T21:00:12","date_gmt":"2022-10-18T21:00:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=339921"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=339921","title":{"rendered":"<span>\u0420\u0435\u0441\u0443\u0440\u0441\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0432 CRUD \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 Laravel<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0432 CRUD \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0430 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 Laravel &#8212; \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u043e\u0439 CRM. \u0418\u0442\u0430\u043a \u043d\u0430\u0447\u043d\u0451\u043c.<\/p>\n<p><a href=\"https:\/\/github.com\/deyen01\/crm\" rel=\"noopener noreferrer nofollow\"><strong><em>\u041f\u0440\u043e\u0435\u043a\u0442 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d \u043a\u0430\u043a \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u041f\u041e.<\/em><\/strong><\/a><\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u0447\u0451\u0442\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432: \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0439 \u0438 \u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439, \u0437\u0430\u044f\u0432\u043a\u0438, \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 CRUD.<\/p>\n<h3>\u0418\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u044b<\/h3>\n<p>\u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 PHP &#8212; \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Laravel \u0438 Bootstrap \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0435\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446 HTML. \u0418 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e\u0435 CRUD \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 (<em>create<\/em>), \u0447\u0442\u0435\u043d\u0438\u0435 (<em>read<\/em>), \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f (<em>update<\/em>), \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 (<em>delete<\/em>).<\/p>\n<h2>\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442 Laravel, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Composer:<\/p>\n<pre><code class=\"bash\">composer create-project laravel\/laravel crm.example.com cd crm.example.com<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c Bootstrap, \u0434\u0435\u043b\u0430\u0435\u043c \u0444\u043e\u0440\u043c\u0443 \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 npm:<\/p>\n<pre><code class=\"bash\">composer require laravel\/ui php artisan ui bootstrap php artisan ui bootstrap --auth npm install npm run dev<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043e\u0434\u043d\u043e \u043a \u043d\u0435\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e, \u0444\u0430\u0431\u0440\u0438\u043a\u0443, \u043d\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c, \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u0444\u043e\u0440\u043c\u044b:<\/p>\n<pre><code class=\"bash\">php artisan make:model Client --all<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0442\u0430\u043a\u0436\u0435. \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u0435\u0441\u0441\u0438\u0439 \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439:<\/p>\n<pre><code class=\"bash\">php artisan session:table php artisan queue:table<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u043f\u0430\u043f\u043a\u0435 <code>database\/seeder<\/code> \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f-\u0430\u0434\u043c\u0438\u043d\u0430:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace Database\\Seeders;  use Illuminate\\Database\\Seeder; use Illuminate\\Support\\Facades\\DB; use Illuminate\\Support\\Facades\\Hash;  class UserSeeder extends Seeder {     public function run()     {         DB::table('users')->insert([             [                 'name' => 'admin',                 'email' => 'admin@example.com',                 'access_level' => 2,                 'password' => Hash::make('\u0442\u0432\u043e\u0439_\u043f\u0430\u0440\u043e\u043b\u044c')             ]         ]);     } }<\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438. \u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... class CreateClientsTable extends Migration {     public function up()     {         Schema::create('clients', function (Blueprint $table) {             $table->id();             $table->string('fulltitle', 512)->nullable();             $table->string('title', 128)->nullable();             \/* ... \u0442\u0443\u0442 \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0439 \u0434\u043b\u044f \u0432\u0441\u044f\u043a\u0438\u0445 \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u043e\u0432 ... *\/              $table->string('tel', 10)->nullable(); \/\/ \u0422\u0435\u043b\u0435\u0444\u043e\u043d             $table->string('comment', 255)->nullable(); \/\/ \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439             $table->foreignId('creater_id') \/\/ \u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0437\u0434\u0430\u043b                 ->nullable()                 ->constrained('users')                 ->cascadeOnUpdate()                 ->nullOnDelete();             $table->foreignId('updater_id') \/\/ \u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u043d\u0451\u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f                 ->nullable()                 ->constrained('users')                 ->cascadeOnUpdate()                 ->nullOnDelete();             $table->timestamps();         });     }      public function down()     {         Schema::dropIfExists('clients');     } }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0411\u0414:<\/p>\n<pre><code class=\"bash\">php artisan migrate:fresh --seed<\/code><\/pre>\n<p>:fresh &#8212; \u0443\u0434\u0430\u043b\u0438\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0411\u0414.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0432 \u043f\u0430\u043f\u043a\u0435 <code>app\/Http\/Controllers<\/code> \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441 \u0436\u0434\u0430\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 <code>ClientController<\/code>. \u0422\u0430\u043c \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u044b \u043c\u0435\u0442\u043e\u0434\u044b: index, create, store, show, edit, update, destroy.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 index \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0432\u044b\u0432\u043e\u0434\u0438\u043b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044f \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u043e 20 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 Blade \u0448\u0430\u0431\u043b\u043e\u043d &#8216;client-index&#8217;:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... public function index() {   return view('client-index', ['clients' => Client::orderByDesc('id')->paginate(20)]); }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 create \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u0438 \u043a\u043d\u043e\u043f\u043a\u0443 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0432 \u0411\u0414. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Blade \u0448\u0430\u0431\u043b\u043e\u043d &#8216;client-edit&#8217; \u0438 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0434\u043b\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u043e\u043d\u0438\u043c\u0430\u043b, \u043a\u0430\u043a\u043e\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0437 \u044d\u0442\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e edit , \u0433\u0434\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0 &#8212; \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e, \u0430 1 &#8212; \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e client \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0438 Client<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... public function create() {   return view('client-edit', ['edit' => 0, 'client' => new Client()]); }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 edit \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u043c\u0435\u0442\u043e\u0434 create. \u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0434\u0435\u0441\u044c edit = 1, \u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f client \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043c\u0430\u0440\u0448\u0440\u0443\u0442:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... public function edit(Client $client) {   return view('client-edit', ['edit' => 1, 'client' => $client]); }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 show \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... public function show(Client $client) {   return view('client-show', ['client' => $client]); }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 store \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432 \u0411\u0414, \u0430 \u043c\u0435\u0442\u043e\u0434 update \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0432 \u0411\u0414:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... public function store(StoreClientRequest $request) {     $validated = $request->validated();     $client = Client::create($validated);     return redirect()->route('clients.show', $client); }  public function update(UpdateClientRequest $request, Client $client) {     $validated = $request->validated();     $client->fill($validated);     $client->updater_id = Auth::id();     $client->save();     return redirect()->route('clients.show', $client); }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 destroy \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u0437 \u0411\u0414:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... public function destroy(Client $client) {   if (Auth::user()->access_level == 2) {     $client->delete();     return redirect()->route('clients.index');   } else {     return null;   } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 StoreClientRequest \u0438 UpdateClientRequest. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0411\u0414, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0439\u0442\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041e\u043d\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u0444\u043e\u0440\u043c\u044b \u0438 \u043b\u0435\u0436\u0430\u0442 \u0432 \u043f\u0430\u043f\u043a\u0435 app\/Http\/Requests. \u0422\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c StoreClientRequest, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u0435\u0440\u0435\u0434 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Http\\Requests;  use Illuminate\\Foundation\\Http\\FormRequest;  class StoreClientRequest extends FormRequest {      *\/     public function authorize()     {         return ($this->user()->access_level > 0); \/\/ \u0438\u043c\u0435\u0435\u0442 \u043b\u0438 \u043f\u0440\u0430\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0435\u043b\u044c \u043d\u0430 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435     }      public function rules()     {         return [             'fulltitle' => ['nullable', 'string', 'max:512'],             'title' => ['nullable', 'string', 'max:128'],             \/* ... \u0442\u0443\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0439 \u0434\u043b\u044f \u0432\u0441\u044f\u043a\u0438\u0445 \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u043e\u0432 ... *\/             'tel' => ['nullable', 'string', 'max:10'],             'comment' => ['nullable', 'string', 'max:255']         ];     } } <\/code><\/pre>\n<p>UpdateClientRequest \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0436\u0435.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0432 routes\/web.php:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... \/\/ \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430 \u0432\u0445\u043e\u0434\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0432 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u0441\u0431\u0440\u043e\u0441\u0430 \u043f\u0430\u0440\u043e\u043b\u044f \u0438 \u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 Auth::routes(['register' => false, 'reset' => false,'verify' => false]);  \/\/ \u0441\u0442\u0430\u0432\u0438\u043c \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a auth, \u0447\u0442\u043e\u0431\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u043b\u0438 \u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e \u044d\u0442\u0438\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c Route::group(['middleware' => 'auth'], function() {     Route::resources([         'clients' => ClientController::class,         'clients.representatives' => ClientRepresentativeController::class,         \/* \u0442\u0443\u0442 \u0435\u0449\u0451 \u043a\u0443\u0447\u0430 \u0441\u0442\u0440\u043e\u043a *\/     ]); });<\/code><\/pre>\n<p>\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0440\u0435\u0441\u0443\u0440\u0441\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 Laravel, \u043d\u0435 \u043d\u0430\u0434\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442. \u0414\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0440\u0435\u0441\u0443\u0440\u0441\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>Route::resources<\/code> , \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u0435\u0441\u0443\u0440\u0441\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432. \u0422\u0430\u043a \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 Laravel \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b:<\/p>\n<ul>\n<li>\n<p>clients.index<\/p>\n<\/li>\n<li>\n<p>clients.show<\/p>\n<\/li>\n<li>\n<p>clients.create<\/p>\n<\/li>\n<li>\n<p>clients.edit<\/p>\n<\/li>\n<li>\n<p>clients.store<\/p>\n<\/li>\n<li>\n<p>clients.update<\/p>\n<\/li>\n<li>\n<p>clients.destroy<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e <code>'clients.representatives' => ClientRepresentativeController::class<\/code> , \u044d\u0442\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u0412 \u043d\u0430\u0448\u0435\u0439 CRM \u0432\u0435\u0434\u0451\u0442\u0441\u044f \u0443\u0447\u0451\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u0431\u0438\u0437\u043d\u0435\u0441-\u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u041c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0447\u0435\u0440\u043d\u0435\u0439 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u0418 \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 \u0432\u0440\u043e\u0434\u0435 <code>https:\/\/crm.example.com\/clients\/123\/representatives<\/code>, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Http\\Controllers;  use App\\Http\\Requests\\StoreRepresentativeRequest; use App\\Models\\Representative; use App\\Models\\Client;  class ClientRepresentativeController extends Controller {     public function index(Client $client)     {         return view('representative-index', ['client' => $client, 'representatives' => Representative::where(['client_id' => $client->id])->orderByDesc('id')->paginate(20)]);     }      public function create(Client $client)     {         return view('representative-edit', ['edit' => 0, 'representative' => new Representative(['client_id' => $client->id])]);     }      public function store(StoreRepresentativeRequest $request, Client $client)     {         $validated = $request->validated();         $representative = new Representative(['client_id' => $client->id]);         $representative->fill($validated);         $representative->save();         return redirect()->route('representatives.show', $representative);     } }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 index \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u041c\u0435\u0442\u043e\u0434 create \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u043a\u0430\u0436\u0435\u0442 \u0434\u043b\u044f \u043a\u0430\u043a\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f. \u041c\u0435\u0442\u043e\u0434 store \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u043e \u043d\u043e\u0432\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c id \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<p>\u0410 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u044f\u0445 \u0438\u043c\u0435\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u0438 \u0441 \u043d\u0438\u043c\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 RepresentativeController. \u0410 Laravel \u043d\u0430\u043c \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>clients.representatives.index<\/p>\n<\/li>\n<li>\n<p>clients.representatives.create<\/p>\n<\/li>\n<li>\n<p>clients.representatives.store<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u0434, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b Blade \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435<a href=\"https:\/\/github.com\/deyen01\/crm\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/deyen01\/crm<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/694176\/\"> https:\/\/habr.com\/ru\/post\/694176\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0432 CRUD \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0430 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435 Laravel &#8212; \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u043e\u0439 CRM. \u0418\u0442\u0430\u043a \u043d\u0430\u0447\u043d\u0451\u043c.<\/p>\n<p><a href=\"https:\/\/github.com\/deyen01\/crm\" rel=\"noopener noreferrer nofollow\"><strong><em>\u041f\u0440\u043e\u0435\u043a\u0442 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d \u043a\u0430\u043a \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u041f\u041e.<\/em><\/strong><\/a><\/p>\n<h2>\u0417\u0430\u0434\u0430\u0447\u0430<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u0447\u0451\u0442\u0430 \u0431\u0438\u0437\u043d\u0435\u0441-\u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432: \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0439 \u0438 \u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439, \u0437\u0430\u044f\u0432\u043a\u0438, \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u0434\u043e\u0433\u043e\u0432\u043e\u0440\u0430 \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 CRUD.<\/p>\n<h3>\u0418\u043d\u0433\u0440\u0435\u0434\u0438\u0435\u043d\u0442\u044b<\/h3>\n<p>\u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 PHP &#8212; \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Laravel \u0438 Bootstrap \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0435\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446 HTML. \u0418 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u043e\u0435 CRUD \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0442\u043e \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0434\u043b\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439: \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 (<em>create<\/em>), \u0447\u0442\u0435\u043d\u0438\u0435 (<em>read<\/em>), \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f (<em>update<\/em>), \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 (<em>delete<\/em>).<\/p>\n<h2>\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c<\/h2>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442 Laravel, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Composer:<\/p>\n<pre><code class=\"bash\">composer create-project laravel\/laravel crm.example.com cd crm.example.com<\/code><\/pre>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c Bootstrap, \u0434\u0435\u043b\u0430\u0435\u043c \u0444\u043e\u0440\u043c\u0443 \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 npm:<\/p>\n<pre><code class=\"bash\">composer require laravel\/ui php artisan ui bootstrap php artisan ui bootstrap --auth npm install npm run dev<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043e\u0434\u043d\u043e \u043a \u043d\u0435\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u044e, \u0444\u0430\u0431\u0440\u0438\u043a\u0443, \u043d\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c, \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u0444\u043e\u0440\u043c\u044b:<\/p>\n<pre><code class=\"bash\">php artisan make:model Client --all<\/code><\/pre>\n<p>\u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u0442\u0430\u043a\u0436\u0435. \u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0441\u0435\u0441\u0441\u0438\u0439 \u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u0435\u0439:<\/p>\n<pre><code class=\"bash\">php artisan session:table php artisan queue:table<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u043f\u0430\u043f\u043a\u0435 <code>database\/seeder<\/code> \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f-\u0430\u0434\u043c\u0438\u043d\u0430:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace Database\\Seeders;  use Illuminate\\Database\\Seeder; use Illuminate\\Support\\Facades\\DB; use Illuminate\\Support\\Facades\\Hash;  class UserSeeder extends Seeder {     public function run()     {         DB::table('users')->insert([             [                 'name' => 'admin',                 'email' => 'admin@example.com',                 'access_level' => 2,                 'password' => Hash::make('\u0442\u0432\u043e\u0439_\u043f\u0430\u0440\u043e\u043b\u044c')             ]         ]);     } }<\/code><\/pre>\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438. \u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... class CreateClientsTable extends Migration {     public function up()     {         Schema::create('clients', function (Blueprint $table) {             $table->id();             $table->string('fulltitle', 512)->nullable();             $table->string('title', 128)->nullable();             \/* ... \u0442\u0443\u0442 \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0439 \u0434\u043b\u044f \u0432\u0441\u044f\u043a\u0438\u0445 \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u043e\u0432 ... *\/              $table->string('tel', 10)->nullable(); \/\/ \u0422\u0435\u043b\u0435\u0444\u043e\u043d             $table->string('comment', 255)->nullable(); \/\/ \u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439             $table->foreignId('creater_id') \/\/ \u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0441\u043e\u0437\u0434\u0430\u043b                 ->nullable()                 ->constrained('users')                 ->cascadeOnUpdate()                 ->nullOnDelete();             $table->foreignId('updater_id') \/\/ \u043a\u0430\u043a\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u043d\u0451\u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f                 ->nullable()                 ->constrained('users')                 ->cascadeOnUpdate()                 ->nullOnDelete();             $table->timestamps();         });     }      public function down()     {         Schema::dropIfExists('clients');     } }<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u043d\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0411\u0414:<\/p>\n<pre><code class=\"bash\">php artisan migrate:fresh --seed<\/code><\/pre>\n<p>:fresh &#8212; \u0443\u0434\u0430\u043b\u0438\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0411\u0414.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0432 \u043f\u0430\u043f\u043a\u0435 <code>app\/Http\/Controllers<\/code> \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441 \u0436\u0434\u0430\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 <code>ClientController<\/code>. \u0422\u0430\u043c \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u044b \u043c\u0435\u0442\u043e\u0434\u044b: index, create, store, show, edit, update, destroy.<\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 index \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0432\u044b\u0432\u043e\u0434\u0438\u043b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u044f \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u043e 20 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 Blade \u0448\u0430\u0431\u043b\u043e\u043d &#8216;client-index&#8217;:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... public function index() {   return view('client-index', ['clients' => Client::orderByDesc('id')->paginate(20)]); }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 create \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0435 \u0438 \u043a\u043d\u043e\u043f\u043a\u0443 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0432 \u0411\u0414. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Blade \u0448\u0430\u0431\u043b\u043e\u043d &#8216;client-edit&#8217; \u0438 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0434\u043b\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u043e\u043d\u0438\u043c\u0430\u043b, \u043a\u0430\u043a\u043e\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0437 \u044d\u0442\u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e edit , \u0433\u0434\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0 &#8212; \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e, \u0430 1 &#8212; \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e client \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043c\u043e\u0434\u0435\u043b\u0438 Client<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... public function create() {   return view('client-edit', ['edit' => 0, 'client' => new Client()]); }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 edit \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u043c\u0435\u0442\u043e\u0434 create. \u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0434\u0435\u0441\u044c edit = 1, \u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f client \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043c\u0430\u0440\u0448\u0440\u0443\u0442:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... public function edit(Client $client) {   return view('client-edit', ['edit' => 1, 'client' => $client]); }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 show \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0430:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... public function show(Client $client) {   return view('client-show', ['client' => $client]); }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 store \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0432 \u0411\u0414, \u0430 \u043c\u0435\u0442\u043e\u0434 update \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0432 \u0411\u0414:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... public function store(StoreClientRequest $request) {     $validated = $request->validated();     $client = Client::create($validated);     return redirect()->route('clients.show', $client); }  public function update(UpdateClientRequest $request, Client $client) {     $validated = $request->validated();     $client->fill($validated);     $client->updater_id = Auth::id();     $client->save();     return redirect()->route('clients.show', $client); }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 destroy \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u0437 \u0411\u0414:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... public function destroy(Client $client) {   if (Auth::user()->access_level == 2) {     $client->delete();     return redirect()->route('clients.index');   } else {     return null;   } }<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 StoreClientRequest \u0438 UpdateClientRequest. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0411\u0414, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0439\u0442\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041e\u043d\u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438 \u0444\u043e\u0440\u043c\u044b \u0438 \u043b\u0435\u0436\u0430\u0442 \u0432 \u043f\u0430\u043f\u043a\u0435 app\/Http\/Requests. \u0422\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c StoreClientRequest, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u0435\u0440\u0435\u0434 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Http\\Requests;  use Illuminate\\Foundation\\Http\\FormRequest;  class StoreClientRequest extends FormRequest {      *\/     public function authorize()     {         return ($this->user()->access_level > 0); \/\/ \u0438\u043c\u0435\u0435\u0442 \u043b\u0438 \u043f\u0440\u0430\u0432\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0435\u043b\u044c \u043d\u0430 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435     }      public function rules()     {         return [             'fulltitle' => ['nullable', 'string', 'max:512'],             'title' => ['nullable', 'string', 'max:128'],             \/* ... \u0442\u0443\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u0435\u0439 \u0434\u043b\u044f \u0432\u0441\u044f\u043a\u0438\u0445 \u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u043e\u0432 ... *\/             'tel' => ['nullable', 'string', 'max:10'],             'comment' => ['nullable', 'string', 'max:255']         ];     } } <\/code><\/pre>\n<p>UpdateClientRequest \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0436\u0435.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0432 routes\/web.php:<\/p>\n<pre><code class=\"php\">&lt;?php \/\/ ... \/\/ \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043d\u0430 \u0432\u0445\u043e\u0434\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0432 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u0441\u0431\u0440\u043e\u0441\u0430 \u043f\u0430\u0440\u043e\u043b\u044f \u0438 \u0432\u0435\u0440\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 Auth::routes(['register' => false, 'reset' => false,'verify' => false]);  \/\/ \u0441\u0442\u0430\u0432\u0438\u043c \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a auth, \u0447\u0442\u043e\u0431\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u043b\u0438 \u0445\u043e\u0434\u0438\u0442\u044c \u043f\u043e \u044d\u0442\u0438\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c Route::group(['middleware' => 'auth'], function() {     Route::resources([         'clients' => ClientController::class,         'clients.representatives' => ClientRepresentativeController::class,         \/* \u0442\u0443\u0442 \u0435\u0449\u0451 \u043a\u0443\u0447\u0430 \u0441\u0442\u0440\u043e\u043a *\/     ]); });<\/code><\/pre>\n<p>\u041c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0440\u0435\u0441\u0443\u0440\u0441\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 Laravel, \u043d\u0435 \u043d\u0430\u0434\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442. \u0414\u043b\u044f \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0440\u0435\u0441\u0443\u0440\u0441\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>Route::resources<\/code> , \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u0435\u0441\u0443\u0440\u0441\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432. \u0422\u0430\u043a \u0434\u043b\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 Laravel \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b:<\/p>\n<ul>\n<li>\n<p>clients.index<\/p>\n<\/li>\n<li>\n<p>clients.show<\/p>\n<\/li>\n<li>\n<p>clients.create<\/p>\n<\/li>\n<li>\n<p>clients.edit<\/p>\n<\/li>\n<li>\n<p>clients.store<\/p>\n<\/li>\n<li>\n<p>clients.update<\/p>\n<\/li>\n<li>\n<p>clients.destroy<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e <code>'clients.representatives' => ClientRepresentativeController::class<\/code> , \u044d\u0442\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432. \u0412 \u043d\u0430\u0448\u0435\u0439 CRM \u0432\u0435\u0434\u0451\u0442\u0441\u044f \u0443\u0447\u0451\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u0431\u0438\u0437\u043d\u0435\u0441-\u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u041c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e\u0447\u0435\u0440\u043d\u0435\u0439 \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432. \u0418 \u0447\u0442\u043e\u0431\u044b \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 \u0432\u0440\u043e\u0434\u0435 <code>https:\/\/crm.example.com\/clients\/123\/representatives<\/code>, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432:<\/p>\n<pre><code class=\"php\">&lt;?php  namespace App\\Http\\Controllers;  use App\\Http\\Requests\\StoreRepresentativeRequest; use App\\Models\\Representative; use App\\Models\\Client;  class ClientRepresentativeController extends Controller {     public function index(Client $client)     {         return view('representative-index', ['client' => $client, 'representatives' => Representative::where(['client_id' => $client->id])->orderByDesc('id')->paginate(20)]);     }      public function create(Client $client)     {         return view('representative-edit', ['edit' => 0, 'representative' => new Representative(['client_id' => $client->id])]);     }      public function store(StoreRepresentativeRequest $request, Client $client)     {         $validated = $request->validated();         $representative = new Representative(['client_id' => $client->id]);         $representative->fill($validated);         $representative->save();         return redirect()->route('representatives.show', $representative);     } }<\/code><\/pre>\n<p>\u041c\u0435\u0442\u043e\u0434 index \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435\u0439 \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u041c\u0435\u0442\u043e\u0434 create \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0443\u043a\u0430\u0436\u0435\u0442 \u0434\u043b\u044f \u043a\u0430\u043a\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f. \u041c\u0435\u0442\u043e\u0434 store \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u043e \u043d\u043e\u0432\u043e\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u0435 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c id \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<p>\u0410 \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043b\u044f\u0445 \u0438\u043c\u0435\u0435\u0442 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u0438 \u0441 \u043d\u0438\u043c\u0438 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0440\u0435\u0441\u0443\u0440\u0441\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 RepresentativeController. \u0410 Laravel \u043d\u0430\u043c \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>clients.representatives.index<\/p>\n<\/li>\n<li>\n<p>clients.representatives.create<\/p>\n<\/li>\n<li>\n<p>clients.representatives.store<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u0434, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b Blade \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435<a href=\"https:\/\/github.com\/deyen01\/crm\" rel=\"noopener noreferrer nofollow\">https:\/\/github.com\/deyen01\/crm<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/694176\/\"> https:\/\/habr.com\/ru\/post\/694176\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-339921","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/339921","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=339921"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/339921\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=339921"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=339921"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=339921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}