{"id":3723,"date":"2021-07-28T08:04:20","date_gmt":"2021-07-28T08:04:20","guid":{"rendered":"https:\/\/www.bearloga.space\/?page_id=3723"},"modified":"2021-07-28T08:04:21","modified_gmt":"2021-07-28T08:04:21","slug":"laravel-kontrollery","status":"publish","type":"page","link":"https:\/\/www.bearloga.space\/uk\/laravel-kontrollery\/","title":{"rendered":"Laravel \u2014 \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 MVC \u0431\u0443\u043a\u0432\u0430 \u00abC\u00bb \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440.&nbsp;\u041e\u043d \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u0430\u043a \u0442\u0440\u0430\u0444\u0438\u043a \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438.&nbsp;\u0412 \u044d\u0442\u043e\u0439 \u0433\u043b\u0430\u0432\u0435 \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435 \u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445 \u0432 Laravel.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u043b\u0438 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Artisan CLI (\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php artisan make:controller &lt;controller-name&gt; --plain\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u0435 &lt;\u0438\u043c\u044f-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430&gt; \u043d\u0430 \u0438\u043c\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.&nbsp;\u042d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u2014&nbsp;<strong>\u043e\u0431\u044b\u0447\u043d\u044b\u0439<\/strong>&nbsp;.&nbsp;\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442.&nbsp;\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432&nbsp;<strong>app \/ Http \/ Controllers<\/strong>&nbsp;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0431\u0430\u0437\u043e\u0432\u043e\u0435 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u0430\u0441 \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043e, \u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434.&nbsp;\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u0437\u0432\u0430\u043d \u0438\u0437 rout.php \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0443.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">Route::get(\u2018base URI\u2019,\u2019controller@method\u2019);\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u043f\u0440\u0438\u043c\u0435\u0440<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 1<\/strong>&nbsp;\u2014 \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c&nbsp;<strong>UserController<\/strong>&nbsp;.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php artisan make:controller UserController --plain\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 2<\/strong>&nbsp;\u2014 \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0432\u043e\u0434.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/coderlessons.com\/wp-content\/uploads\/2019\/07\/usercontroller.png\" alt=\"UserController\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 3<\/strong>&nbsp;\u2014 \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432&nbsp;<strong>app \/ Http \/ Controller \/ UserController.php<\/strong>&nbsp;\u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u043e\u0439, \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u0434\u043b\u044f \u0432\u0430\u0441, \u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0443 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0430\u0448\u0438\u0445 \u043f\u043e\u0442\u0440\u0435\u0431\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse App\\Http\\Requests;\nuse App\\Http\\Controllers\\Controller;\n\nclass UserController extends Controller {\n   \/\/\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u041f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u041f\u041e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041c\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\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, \u0438 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c.&nbsp;\u041f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\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 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043e \u043d\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0438\u043b\u0438 \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.&nbsp;\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443.&nbsp;\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\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 \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">Route::get('profile', [\n   'middleware' =&gt; 'auth',\n   'uses' =&gt; 'UserController@showProfile'\n]);\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u041f\u041e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f UserController \u0432 \u043f\u0440\u043e\u0444\u0438\u043b\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0433\u043e \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse App\\Http\\Requests;\nuse App\\Http\\Controllers\\Controller;\n\nclass UserController extends Controller {\n   public function __construct() {\n      $this-&gt;middleware('auth');\n   }\n}\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u041f\u041e&nbsp;<strong>\u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438,<\/strong>&nbsp;\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u041f\u041e \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435&nbsp;<strong>UserController<\/strong>&nbsp;.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u043f\u0440\u0438\u043c\u0435\u0440<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 1<\/strong>&nbsp;\u2014 \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0434\u0430 \u0432 \u0444\u0430\u0439\u043b&nbsp;<strong>app \/ Http \/ rout.php<\/strong>&nbsp;\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u0435\u0433\u043e.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>routes.php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php\nRoute::get('\/usercontroller\/path',[\n   'middleware' =&gt; 'First',\n   'uses' =&gt; 'UserController@showPath'\n]);\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 2<\/strong>&nbsp;\u2014 \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\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 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c&nbsp;<strong>FirstMiddleware<\/strong>&nbsp;, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043e\u0434\u0430.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php artisan make:middleware FirstMiddleware\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 3<\/strong>&nbsp;\u2014 \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 \u043c\u0435\u0442\u043e\u0434&nbsp;<strong>handle<\/strong>&nbsp;\u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e FirstMiddleware \u0432&nbsp;<strong>app \/ Http \/ Middleware<\/strong>&nbsp;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>FirstMiddleware.php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php\n\nnamespace App\\Http\\Middleware;\nuse Closure;\n\nclass FirstMiddleware {\n   public function handle($request, Closure $next) {\n      echo '&lt;br&gt;First Middleware';\n      return $next($request);\n   }\n}\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 4<\/strong>&nbsp;\u2014 \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\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 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c&nbsp;<strong>SecondMiddleware<\/strong>&nbsp;, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php artisan make:middleware SecondMiddleware\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 5<\/strong>&nbsp;\u2014 \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 \u043c\u0435\u0442\u043e\u0434 handle \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e SecondMiddleware \u0432&nbsp;<strong>app \/ Http \/ Middleware<\/strong>&nbsp;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>SecondMiddleware.php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php\n\nnamespace App\\Http\\Middleware;\nuse Closure;\n\nclass SecondMiddleware {\n   public function handle($request, Closure $next) {\n      echo '&lt;br&gt;Second Middleware';\n      return $next($request);\n   }\n}\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 6<\/strong>&nbsp;\u2014 \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c&nbsp;<strong>UserController<\/strong>&nbsp;, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php artisan make:controller UserController --plain\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 7.<\/strong>&nbsp;\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f URL \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0432\u043e\u0434:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/coderlessons.com\/wp-content\/uploads\/2019\/07\/usercontroller1.png\" alt=\"UserController1\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 8<\/strong>&nbsp;\u2014 \u0421\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b&nbsp;<strong>app \/ Http \/ UserController.php<\/strong>&nbsp;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \/ Http \/ UserController.php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse App\\Http\\Requests;\nuse App\\Http\\Controllers\\Controller;\n\nclass UserController extends Controller {\n   public function __construct() {\n      $this-&gt;middleware('Second');\n   }\n   public function showPath(Request $request) {\n      $uri = $request-&gt;path();\n      echo '&lt;br&gt;URI: '.$uri;\n      \n      $url = $request-&gt;url();\n      echo '&lt;br&gt;';\n      \n      echo 'URL: '.$url;\n      $method = $request-&gt;method();\n      echo '&lt;br&gt;';\n      \n      echo 'Method: '.$method;\n   }\n}\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 9<\/strong>&nbsp;\u2014 \u0422\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 php, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0435\u0441\u043b\u0438 \u0432\u044b \u0435\u0449\u0435 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0438 \u0435\u0435.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php artisan serve\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 10<\/strong>&nbsp;\u2014 \u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 URL.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">http:\/\/localhost:8000\/usercontroller\/path\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 11<\/strong>\u00a0\u2014 \u0412\u044b\u0432\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0438\u0441\u0443\u043d\u043a\u0435.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/coderlessons.com\/wp-content\/uploads\/2019\/07\/usercontroller2.png\" alt=\"UserController2\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Restful Resource Controllers<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0427\u0430\u0441\u0442\u043e \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438&nbsp;<strong>CRUD (\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435, \u0447\u0442\u0435\u043d\u0438\u0435, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435)<\/strong>&nbsp;.&nbsp;Laravel \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u043d\u0430\u043c \u044d\u0442\u0443 \u0440\u0430\u0431\u043e\u0442\u0443.&nbsp;\u041f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u0438 Laravel \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 CRUD.&nbsp;\u0412\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u044b\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b\u0435 rout.php.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u043f\u0440\u0438\u043c\u0435\u0440<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 1<\/strong>&nbsp;\u2014 \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440&nbsp;<strong>MyController<\/strong>&nbsp;, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php artisan make:controller MyController\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 2<\/strong>&nbsp;\u2014 \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0424\u0430\u0439\u043b&nbsp;<strong>app \/ Http \/ Controllers \/ MyController.php<\/strong>&nbsp;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \/ Http \/ \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \/ MyController.php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse App\\Http\\Requests;\nuse App\\Http\\Controllers\\Controller;\n\nclass MyController extends Controller {\n   public function index() {\n      echo 'index';\n   }\n   public function create() {\n      echo 'create';\n   }\n   public function store(Request $request) {\n      echo 'store';\n   }\n   public function show($id) {\n      echo 'show';\n   }\n   public function edit($id) {\n      echo 'edit';\n   }\n   public function update(Request $request, $id) {\n      echo 'update';\n   }\n   public function destroy($id) {\n      echo 'destroy';\n   }\n}\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 3<\/strong>&nbsp;\u2014 \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043a\u043e\u0434\u0430 \u0432 \u0444\u0430\u0439\u043b&nbsp;<strong>app \/ Http \/ rout.php<\/strong>&nbsp;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \/ Http \/ routes.php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Route::resource('my','MyController');\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 4<\/strong>&nbsp;\u2014 \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b MyController, \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0441 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u043c.&nbsp;\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>\u0433\u043b\u0430\u0433\u043e\u043b<\/th><th>\u0414\u043e\u0440\u043e\u0436\u043a\u0430<\/th><th>\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435<\/th><th>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430<\/th><\/tr><tr><td>\u041f\u041e\u041b\u0423\u0427\u0418\u0422\u042c<\/td><td>\/ \u043c\u043e\u0439<\/td><td>\u0438\u043d\u0434\u0435\u043a\u0441<\/td><td>my.index<\/td><\/tr><tr><td>\u041f\u041e\u041b\u0423\u0427\u0418\u0422\u042c<\/td><td>\/ \u041c\u043e\u0439 \/ \u0441\u043e\u0437\u0434\u0430\u0442\u044c<\/td><td>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435<\/td><td>my.create<\/td><\/tr><tr><td>\u0421\u041e\u041e\u0411\u0429\u0415\u041d\u0418\u0415<\/td><td>\/ \u043c\u043e\u0439<\/td><td>\u0445\u0440\u0430\u043d\u0438\u0442\u044c<\/td><td>my.store<\/td><\/tr><tr><td>\u041f\u041e\u041b\u0423\u0427\u0418\u0422\u042c<\/td><td>\/\u043c\u043e\u0439 \u043c\u043e\u0439}<\/td><td>\u0448\u043e\u0443<\/td><td>my.show<\/td><\/tr><tr><td>\u041f\u041e\u041b\u0423\u0427\u0418\u0422\u042c<\/td><td>\/ \u041c\u043e\u0439 \/ {\u043c\u043e\u0439} \/ \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/td><td>\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/td><td>my.edit<\/td><\/tr><tr><td>PUT \/ PATCH<\/td><td>\/\u043c\u043e\u0439 \u043c\u043e\u0439}<\/td><td>\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c<\/td><td>my.update<\/td><\/tr><tr><td>\u0423\u0414\u0410\u041b\u042f\u0422\u042c<\/td><td>\/\u043c\u043e\u0439 \u043c\u043e\u0439}<\/td><td>\u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c<\/td><td>my.destroy<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 5<\/strong>&nbsp;\u2014 \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c URL-\u0430\u0434\u0440\u0435\u0441\u0430, \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>URL<\/th><th>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435<\/th><th>\u0412\u044b\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/th><\/tr><tr><td>HTTP: \/\/ \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439: 8000 \/ \u043c\u043e\u0439<\/td><td>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 MyController.php<\/td><td>\u0438\u043d\u0434\u0435\u043a\u0441<\/td><\/tr><tr><td>HTTP: \/\/ \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439: 8000 \/ \u043c\u043e\u0439 \/ \u0441\u043e\u0437\u0434\u0430\u0442\u044c<\/td><td>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f MyController.php<\/td><td>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435<\/td><\/tr><tr><td>HTTP: \/\/ \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439: 8000 \/ \u043c\u0435\u043d\u044f \/ 1<\/td><td>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u043a\u0430\u0437\u0430 MyController.php<\/td><td>\u0448\u043e\u0443<\/td><\/tr><tr><td>HTTP: \/\/ \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439: 8000 \/ \u043c\u043e\u0439 \/ 1 \/ \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/td><td>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f MyController.php<\/td><td>\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u041d\u0435\u044f\u0432\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u041d\u0435\u044f\u0432\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0432\u0430\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043e\u0434\u0438\u043d \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435.&nbsp;\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 route.php \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430&nbsp;<strong>Route: controller,<\/strong>&nbsp;\u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0438\u0436\u0435.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Route::controller(\u2018base URI\u2019,\u2019&lt;class-name-of-the-controller&gt;\u2019);\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u0435 &lt;class-name-of-the-controller&gt; \u043d\u0430 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b \u0434\u0430\u043b\u0438 \u0441\u0432\u043e\u0435\u043c\u0443 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0418\u043c\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441 HTTP-\u0433\u043b\u0430\u0433\u043e\u043b\u0430, \u043a\u0430\u043a get \u0438\u043b\u0438 post.&nbsp;\u0415\u0441\u043b\u0438 \u0432\u044b \u043d\u0430\u0447\u043d\u0435\u0442\u0435 \u0441 get, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441 get, \u0430 \u0435\u0441\u043b\u0438 \u043e\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 post, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 post.&nbsp;\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c HTTP-\u0433\u043b\u0430\u0433\u043e\u043b, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u0438\u043c\u044f \u043c\u0435\u0442\u043e\u0434\u0443, \u043d\u043e \u043e\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u0438 URI \u0432 \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u043f\u0440\u0438\u043c\u0435\u0440<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 1<\/strong>&nbsp;\u2014 \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u0443\u044e \u043d\u0438\u0436\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440.&nbsp;\u041c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u0438\u043c\u044f \u043a\u043b\u0430\u0441\u0441\u0430&nbsp;<strong>ImplicitController<\/strong>&nbsp;.&nbsp;\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u0438\u043c\u044f \u043d\u0430 \u0432\u0430\u0448 \u0432\u044b\u0431\u043e\u0440.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php artisan make:controller ImplicitController --plain\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 2<\/strong>&nbsp;\u2014 \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0448\u0430\u0433\u0430 1 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0432\u043e\u0434 \u2014<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/coderlessons.com\/wp-content\/uploads\/2019\/07\/implicitcontroller.png\" alt=\"Implicitcontroller\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 3<\/strong>&nbsp;\u2014 \u0421\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0424\u0430\u0439\u043b&nbsp;<strong>app \/ Http \/ Controllers \/ ImplicitController.php<\/strong>&nbsp;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \/ Http \/ \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \/ ImplicitController.php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse App\\Http\\Requests;\nuse App\\Http\\Controllers\\Controller;\n\nclass ImplicitController extends Controller {\n   \/**\n      * Responds to requests to GET \/test\n   *\/\n   public function getIndex() {\n      echo 'index method';\n   }\n   \n   \/**\n      * Responds to requests to GET \/test\/show\/1\n   *\/\n   public function getShow($id) {\n      echo 'show method';\n   }\n   \n   \/**\n      * Responds to requests to GET \/test\/admin-profile\n   *\/\n   public function getAdminProfile() {\n      echo 'admin profile method';\n   }\n   \n   \/**\n      * Responds to requests to POST \/test\/profile\n   *\/\n   public function postProfile() {\n      echo 'profile method';\n   }\n}\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 4<\/strong>&nbsp;\u2014 \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0444\u0430\u0439\u043b&nbsp;<strong>app \/ Http \/ rout.php,<\/strong>&nbsp;\u0447\u0442\u043e\u0431\u044b&nbsp;<strong>\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c<\/strong>&nbsp;\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \/ Http \/ routes.php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Route::controller('test','ImplicitController');\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 \u0418\u043d\u044a\u0435\u043a\u0446\u0438\u044f<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0421\u0435\u0440\u0432\u0438\u0441\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 Laravel \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 Laravel.&nbsp;\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0432\u0430\u0448\u0435\u043c\u0443 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 \u0432 \u0435\u0433\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435.&nbsp;\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0431\u0443\u0434\u0443\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u044b \u0438 \u0432\u0432\u0435\u0434\u0435\u043d\u044b \u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u043f\u0440\u0438\u043c\u0435\u0440<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 1<\/strong>&nbsp;\u2014 \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b&nbsp;<strong>app \/ Http \/ rout.php<\/strong>&nbsp;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \/ Http \/ routes.php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">class MyClass{\n   public $foo = 'bar';\n}\nRoute::get('\/myclass','ImplicitController@index');\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 2<\/strong>&nbsp;\u2014 \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0424\u0430\u0439\u043b&nbsp;<strong>app \/ Http \/ Controllers \/ ImplicitController.php<\/strong>&nbsp;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \/ Http \/ \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \/ ImplicitController.php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse App\\Http\\Requests;\nuse App\\Http\\Controllers\\Controller;\n\nclass ImplicitController extends Controller {\n   private $myclass;\n   \n   public function __construct(\\MyClass $myclass) {\n      $this-&gt;myclass = $myclass;\n   }\n   public function index() {\n      dd($this-&gt;myclass);\n   }\n}\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 3<\/strong>&nbsp;\u2014 \u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 URL, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">http:\/\/localhost:8000\/myclass\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 4<\/strong>&nbsp;\u2014 \u0412\u044b\u0432\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0440\u0438\u0441\u0443\u043d\u043a\u0435.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/coderlessons.com\/wp-content\/uploads\/2019\/07\/constructor_injection.png\" alt=\"\u041c\u043e\u0438 \u0437\u0430\u043d\u044f\u0442\u0438\u044f\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u0418\u043d\u044a\u0435\u043a\u0446\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u0412 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u044e \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u0432\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0432\u0435\u0441\u0442\u0438 \u2014 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u043f\u0440\u0438\u043c\u0435\u0440<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 1<\/strong>&nbsp;\u2014 \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b&nbsp;<strong>app \/ Http \/ rout.php<\/strong>&nbsp;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \/ Http \/ routes.php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">class MyClass{\n   public $foo = 'bar';\n}\nRoute::get('\/myclass','ImplicitController@index');\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 2<\/strong>&nbsp;\u2014 \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0424\u0430\u0439\u043b&nbsp;<strong>app \/ Http \/ Controllers \/ ImplicitController.php<\/strong>&nbsp;.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \/ Http \/ \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \/ ImplicitController.php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse App\\Http\\Requests;\nuse App\\Http\\Controllers\\Controller;\n\nclass ImplicitController extends Controller {\n   public function index(\\MyClass $myclass) {\n      dd($myclass);\n   }\n} \n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u0428\u0430\u0433 3<\/strong>&nbsp;\u2014 \u041f\u043e\u0441\u0435\u0442\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 URL, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">http:\/\/localhost:8000\/myclass<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 MVC \u0431\u0443\u043a\u0432\u0430 \u00abC\u00bb \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440.&nbsp;\u041e\u043d \u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u0430\u043a \u0442\u0440\u0430\u0444\u0438\u043a \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438.&nbsp;\u0412 \u044d\u0442\u043e\u0439 \u0433\u043b\u0430\u0432\u0435 \u0432\u044b \u0443\u0437\u043d\u0430\u0435\u0442\u0435 \u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[117],"tags":[],"class_list":["post-3723","page","type-page","status-publish","hentry","category-laravel"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages\/3723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/comments?post=3723"}],"version-history":[{"count":0,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/pages\/3723\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/media?parent=3723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/categories?post=3723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bearloga.space\/uk\/wp-json\/wp\/v2\/tags?post=3723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}