{"id":195690,"date":"2013-09-29T19:06:02","date_gmt":"2013-09-29T15:06:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=195690"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=195690","title":{"rendered":"<span class=\"post_title\">\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0441\u0430\u0439\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Laravel \u0438 Recurly<\/span>"},"content":{"rendered":"<div class=\"content html_format\">       \u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043b\u0430\u0442\u0435\u0436\u0435 \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u043e, \u043d\u043e \u043d\u0435 \u0442\u0430\u043a \u043b\u0435\u0433\u043e\u043a \u043f\u0440\u0438\u0435\u043c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439. \u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e. \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0435\u0448\u0438\u0442\u044c, \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0442\u043a\u0430\u0437\u044b, \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043b\u0430\u0442\u0435\u0436\u0430\u0445 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b, \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435. \u0418 \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441\u0430\u043c\u044b\u0439 \u0432\u0430\u0436\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u2014 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0432\u043e\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u043a\u0443\u0440\u0441\u0435 \u043f\u043b\u0430\u0442\u0435\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435.<br \/>  \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, Recurly \u2014 \u044d\u0442\u043e \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f JavaScript-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043b\u0430\u0442\u0435\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0435 \u0432 \u0441\u0435\u0431\u044f \u0432\u0441\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043b\u0430\u0442\u0435\u0436\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u044b.<br \/>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0441\u0443\u043c\u043c\u0443 \u0438 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439, Recurly \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u0441\u044f \u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u0438 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439, \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0438\u0441\u0430\u043d. Recurly, \u0442\u0430\u043a\u0436\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u0440\u0438\u0444\u043d\u044b\u0445 \u043f\u043b\u0430\u043d\u043e\u0432, \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432, \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u0438 \u0438 \u0432\u044b\u0447\u0435\u0442\u043e\u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439.<br \/>  \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0437 \u0434\u0432\u0443\u0445, \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u0412\u0430\u043c \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043b\u0430\u0442\u043d\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0430\u0439\u0442, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 php-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Laravel \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u0440\u0438\u0435\u043c\u0430 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439 Recurly. \u041c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0430\u0439\u0442\u0430 \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0438 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439, \u0441\u0432\u044f\u0436\u0435\u043c \u0435\u0451 \u0441 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u043f\u043e\u043a\u0443\u043f\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0430\u0440\u0438\u0444\u043d\u044b\u0435 \u043f\u043b\u0430\u043d\u044b.<a name=\"habracut\"><\/a><\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/h4>\n<p>  \u041d\u0430\u0447\u043d\u0451\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u043f\u0430\u043f\u043a\u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:  <\/p>\n<pre><code class=\"bash\">composer create-project laravel\/laravel recurly --prefer-dist <\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 Laravel, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e Composer, \u0441\u043a\u0430\u0447\u0430\u0435\u0442 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0438 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438. \u041f\u043e\u0437\u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 composer.json \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 composer.phar update  <\/p>\n<pre><code class=\"javascript\">&quot;machuga\/authority&quot;: &quot;dev-develop&quot;, &quot;machuga\/authority-l4&quot; : &quot;dev-master&quot;, &quot;recurly\/recurly-client&quot;: &quot;2.1.*@dev&quot; <\/code><\/pre>\n<p>  \u0411\u0443\u0434\u0435\u0442 \u0441\u043a\u0430\u0447\u0430\u043d\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Authority, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0440\u043e\u043b\u0435\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043f\u0440\u0430\u0432 \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Recurly.<br \/>  \u0417\u0430\u0442\u0435\u043c, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u0411\u0414 \u0443\u043a\u0430\u0437\u0430\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0445\u0435\u043c\u044b, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u0430\u0440\u043e\u043b\u044f \u0438 \u0430\u0434\u0440\u0435\u0441\u0441 \u043a \u0411\u0414 \u0432 \u0444\u0430\u0439\u043b\u0435 app\/config\/database.php. Laravel \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u00ab\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u00bb \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u0431\u0430\u0437\u0430\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445: MySql, Posrges, SQLite \u0438 SQL Server.<br \/>  \u041d\u0430\u043c \u0442\u0430\u043a \u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438. \u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0431\u044b \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0451 \u00ab\u0440\u0443\u043a\u0430\u043c\u0438\u00bb, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0439, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 Laravel. \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:  <\/p>\n<pre><code class=\"bash\">php artisan migrate:make create_users_table <\/code><\/pre>\n<p>  \u042d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0444\u0430\u0439\u043b \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 \u043f\u0430\u043f\u043a\u0435 <b>app\/database\/migrations<\/b>  <\/p>\n<pre><code class=\"php\">public function up() {     Schema::create('users', function($table) {         $table-&gt;increments('id');         $table-&gt;string('email')-&gt;unique();         $table-&gt;string('name');         $table-&gt;string('password');         $table-&gt;timestamps();     }); }   public function down() {     Schema::drop('users'); } <\/code><\/pre>\n<p>  \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c:  <\/p>\n<pre><code class=\"bash\">php artisan migrate <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0443\u0432\u0438\u0434\u0438\u043c \u0447\u0442\u043e Laravel \u0441\u043e\u0437\u0434\u0430\u043b \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438.<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0440\u043e\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043f\u0440\u0430\u0432\u0430.<\/h4>\n<p>  \u0414\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u0440\u0430\u0432 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u0440\u043e\u043b\u0438. \u041c\u044b \u0443\u0436\u0435 \u0441\u043a\u0430\u0447\u0430\u043b\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 Authoriry \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e composer, \u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0448\u0430\u0433\u043e\u0432 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u043e\u043b\u0435\u0439 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e.<br \/>  \u0412 \u0444\u0430\u0439\u043b\u0435 <b>app\/config\/app.php<\/b> \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443:  <\/p>\n<pre><code class=\"php\">'Authority\\AuthorityL4\\AuthorityL4ServiceProvider', <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043a \u0430\u043b\u0438\u0430\u0441\u0430\u043c:  <\/p>\n<pre><code class=\"php\">'Authority' =&gt; 'Authority\\AuthorityL4\\Facades\\Authority', <\/code><\/pre>\n<p>  \u0438 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u0443\u0439\u0442\u0435 \u0444\u0430\u0439\u043b \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a Authority \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:  <\/p>\n<pre><code class=\"bash\">php artisan config:publish machuga\/authority-l4 <\/code><\/pre>\n<p>  \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u0444\u0430\u0439\u043b\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043f\u043e\u0437\u0436\u0435. \u0410 \u0441\u0435\u0439\u0447\u0430\u0441, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 \u0432 \u0411\u0414. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, Laravel \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043d\u0438\u0445. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0438\u0445 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:  <\/p>\n<pre><code class=\"bash\">php artisan migrate --package=&quot;machuga\/authority-l4&quot; <\/code><\/pre>\n<p>  \u0412\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u043e\u0441\u044c 3 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u044b: <b>permissions<\/b>, <b>roles<\/b>, <b>role_user<\/b>.<br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0440\u043e\u043b\u044f\u043c\u0438 \u0438 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u041f\u043e\u043a\u0430 \u043c\u044b \u0438\u0445 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438. \u0412 <b>app\/models\/Role.php<\/b>:  <\/p>\n<pre><code class=\"php\">&lt;?php class Role extends Eloquent { } <\/code><\/pre>\n<p>  \u0412 \u0444\u0430\u0439\u043b\u0435: <b>app\/models\/Permission.php<\/b>:  <\/p>\n<pre><code class=\"php\">&lt;?php class Permission extends Eloquent  { } <\/code><\/pre>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c User, \u043e\u043d\u0430 \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430, \u0430 \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0441\u0432\u044f\u0437\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0441 \u0438\u0445 \u0440\u043e\u043b\u044f\u043c\u0438 \u0438 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 <b>app\/models\/User.php<\/b>:  <\/p>\n<pre><code class=\"php\">public function roles() {     return $this-&gt;belongsToMany('Role'); }   public function permissions() {     return $this-&gt;hasMany('Permission'); }   public function hasRole($key) {     foreach($this-&gt;roles as $role){         if ($role-&gt;name === $key) {             return true;         }     }     return false; } <\/code><\/pre>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <b>app\/database\/seeds\/DatabaseSeeder.php<\/b> \u0438 \u0432\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:  <\/p>\n<pre><code class=\"php\">&lt;?php class DatabaseSeeder extends Seeder {     public function run() {         Eloquent::unguard();         $this-&gt;call('UserTableSeeder');         $this-&gt;command-&gt;info('User table seeded!');         $this-&gt;call('RoleTableSeeder');         $this-&gt;command-&gt;info('Role table seeded!');     } }   class UserTableSeeder extends Seeder {     public function run() {         DB::table('users')-&gt;delete();         User::create(array(             'email'    =&gt; 'joe.bloggs@example.com',             'name'     =&gt; 'Joe Bloggs',             'password' =&gt; Hash::make('password')         ));     }   }   class RoleTableSeeder extends Seeder {     public function run() {         DB::table('roles')-&gt;delete();         Role::create(array('name' =&gt; 'admin'));         Role::create(array('name' =&gt; 'pending'));         Role::create(array('name' =&gt; 'member'));         Role::create(array('name' =&gt; 'bronze'));         Role::create(array('name' =&gt; 'silver'));         Role::create(array('name' =&gt; 'gold'));     } } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \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<pre><code class=\"bash\">php artisan db:seed <\/code><\/pre>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0448\u0430\u0431\u043b\u043e\u043d<\/h4>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u0449\u0438\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446. \u0421\u043a\u0430\u0447\u0430\u0435\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e Twitter Bootstrap \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0432 \u043f\u0430\u043f\u043a\u0443 <b>public<\/b>, \u0430 js-\u0444\u0430\u0439\u043b\u044b \u0432 \u043f\u0430\u043f\u043a\u0443 \u2014 <b>public\/js\/libs\/<\/b><br \/>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b <b>app\/views\/layouts\/default.blade.php<\/b> \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043a\u043e\u0434\u043e\u043c:  <\/p>\n<pre><code class=\"html\">&lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt;  &lt;head&gt;   &lt;meta charset=&quot;utf-8&quot;&gt;   &lt;title&gt;Subscription Site Tutorial&lt;\/title&gt;   &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;   &lt;meta name=&quot;description&quot; content=&quot;&quot;&gt;   &lt;meta name=&quot;author&quot; content=&quot;&quot;&gt;     &lt;!-- Le styles --&gt;   &lt;link href=&quot;\/css\/bootstrap.css&quot; rel=&quot;stylesheet&quot;&gt;     &lt;link href=&quot;\/css\/style.css&quot; rel=&quot;stylesheet&quot;&gt;   &lt;\/head&gt;    &lt;body&gt;   &lt;div class=&quot;navbar navbar-inverse navbar-fixed-top&quot;&gt;    &lt;div class=&quot;navbar-inner&quot;&gt;     &lt;div class=&quot;container&quot;&gt;      &lt;button type=&quot;button&quot; class=&quot;btn btn-navbar&quot; data-toggle=&quot;collapse&quot; data-target=&quot;.nav-collapse&quot;&gt;       &lt;span class=&quot;icon-bar&quot;&gt;&lt;\/span&gt;       &lt;span class=&quot;icon-bar&quot;&gt;&lt;\/span&gt;       &lt;span class=&quot;icon-bar&quot;&gt;&lt;\/span&gt;      &lt;\/button&gt;      &lt;a class=&quot;brand&quot; href=&quot;#&quot;&gt;Subscription Site Tutorial&lt;\/a&gt;      &lt;div class=&quot;nav-collapse collapse&quot;&gt;       &lt;ul class=&quot;nav&quot;&gt;        &lt;li class=&quot;active&quot;&gt;&lt;a href=&quot;#&quot;&gt;Home&lt;\/a&gt;&lt;\/li&gt;        &lt;li&gt;&lt;a href=&quot;#about&quot;&gt;About&lt;\/a&gt;&lt;\/li&gt;        &lt;li&gt;&lt;a href=&quot;#contact&quot;&gt;Contact&lt;\/a&gt;&lt;\/li&gt;       &lt;\/ul&gt;      &lt;\/div&gt;&lt;!--\/.nav-collapse --&gt;     &lt;\/div&gt;    &lt;\/div&gt;   &lt;\/div&gt;     &lt;div class=&quot;container&quot;&gt;       @if(Session::has('success'))     &lt;div class=&quot;alert alert-success&quot;&gt;       &lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;alert&quot;&gt;&times;&lt;\/button&gt;       {{ Session::get('success') }}     &lt;\/div&gt;         @endif       @if(Session::has('error'))     &lt;div class=&quot;alert alert-error&quot;&gt;       &lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;alert&quot;&gt;&times;&lt;\/button&gt;       {{ Session::get('error') }}     &lt;\/div&gt;         @endif       @yield('content')     &lt;\/div&gt; &lt;!-- \/container --&gt;     &lt;!-- Le javascript   ================================================== --&gt;   &lt;!-- Placed at the end of the document so the pages load faster --&gt;   &lt;script src=&quot;http:\/\/code.jquery.com\/jquery-1.10.2.min.js&quot;&gt;&lt;\/script&gt;   &lt;script src=&quot;\/js\/libs\/bootstrap.min.js&quot;&gt;&lt;\/script&gt;  &lt;\/body&gt; &lt;\/html&gt; <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430, \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 <b><a href=\"http:\/\/habrahabr.ru\/users\/yield\/\" class=\"user_link\">yield<\/a>(&#8216;content&#8217;)<\/b>.<br \/>  \u0414\u0430\u043b\u0435\u0435, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b <b>public\/css\/style.css<\/b>:  <\/p>\n<pre><code class=\"css\">body {     padding-top: 50px; }   p.logged-in {     color: white;     margin-top: 0.5em; } <\/code><\/pre>\n<p>  \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <b>app\/views\/home\/index.blade.php<\/b>:  <\/p>\n<pre><code class=\"html\">@extends('layouts.default') @section('content')   &lt;h1&gt;Subscription Site Tutorial&lt;\/h1&gt; @stop <\/code><\/pre>\n<p>  <b>@extends<\/b> \u0433\u043e\u0432\u043e\u0440\u0438\u0442 Laravel, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u0438.<br \/>  \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u043e\u0443\u0442\u0438\u043d\u0433 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u0432 \u0444\u0430\u0439\u043b\u0435 <b>app\/routes.php<\/b>:  <\/p>\n<pre><code class=\"php\">Route::get('\/', function() {     return View::make('home\/index'); }); <\/code><\/pre>\n<p>  <\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438<\/h4>\n<p>  \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438, \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u0430\u0442\u044c \u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438. \u0412 \u0444\u0430\u0439\u043b\u0435 <b>app\/routse.php<\/b>, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0443\u0442\u044c \u043a \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0432\u0445\u043e\u0434\u0430:  <\/p>\n<pre><code class=\"php\">Route::get('\/auth\/login', function() {     return View::make('auth\/login'); }); <\/code><\/pre>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 <b>app\/views\/auth\/login.blade.php<\/b>. <b>.blacde<\/b> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440 Blade, \u0438\u0434\u0443\u0449\u0438\u0439 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 Laravel.   <\/p>\n<pre><code class=\"html\">@extends('layouts.default') @section('content')   &lt;h1&gt;Please Log in&lt;\/h1&gt;   {{ Form::open(array('url' =&gt; 'auth\/login')) }}   {{ Form::label('email', 'E-Mail Address') }}   {{ Form::text('email') }}   {{ Form::label('password', 'Password') }}   {{ Form::password('password') }}   &lt;div class=&quot;form-actions&quot;&gt;   {{ Form::submit('Login', array('class' =&gt; 'btn btn-primary')) }}   &lt;\/div&gt;   {{ Form::close() }}   &lt;p&gt;Not a member?  &lt;a href=&quot;\/user\/register&quot;&gt;Register here&lt;\/a&gt;.&lt;\/p&gt; @stop <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u0442\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441 \/auth\/logn \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u0432\u0445\u043e\u0434\u0430. \u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0445\u043e\u0434\u0430, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c POST \u0434\u0430\u043d\u043d\u044b\u0435. \u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 Laravel \u043f\u0440\u043e\u0441\u0442\u0430:  <\/p>\n<pre><code class=\"php\">Route::post('\/auth\/login', function() {     $email = Input::get('email');     $password = Input::get('password');       if (Auth::attempt(array('email' =&gt; $email, 'password' =&gt; $password))) {         return Redirect::to('\/')-&gt;with('success', 'You have been logged in');     }     else {         return Redirect::to('auth\/login')-&gt;with('error', 'Login Failed');     }       return View::make('auth\/login'); }); <\/code><\/pre>\n<p>  \u0412\u0441\u044f \u043c\u0430\u0433\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <b>Auth::attempt()<\/b>, \u0435\u0441\u043b\u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0441\u0435\u0441\u0441\u0438\u044f \u0438 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 User, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 Auth::user()<br \/>  \u041c\u0435\u0442\u043e\u0434 \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430:  <\/p>\n<pre><code class=\"php\">Route::get('\/auth\/logout', function() {     Auth::logout();     return Redirect::to('\/')-&gt;with('success', 'You have successfully logged out'); }); <\/code><\/pre>\n<h4>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f<\/h4>\n<p>  \u041d\u0430\u0448\u0435\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u0432 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0443\u0442\u044c \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 <b>app\/routse\/php<\/b>:  <\/p>\n<pre><code class=\"php\">Route::get('\/user\/register', function() {     return View::make('user\/register\/index'); }); <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 <b>\/app\/views\/user\/register\/index.blade.php<\/b>:  <\/p>\n<pre><code class=\"html\">@extends('layouts.default') @section('content')   {{ Form::open(array('url' =&gt; 'user\/register')) }}             {{ Form::label('email', 'E-Mail Address') }}   {{ Form::text('email') }}   {{ $errors-&gt;first('email') }}     {{ Form::label('name', 'Your name') }}   {{ Form::text('name') }}   {{ $errors-&gt;first('name') }}     {{ Form::label('password', 'Password') }}   {{ Form::password('password') }}   {{ $errors-&gt;first('password') }}     {{ Form::label('password_confirmation', 'Repeat') }}   {{ Form::password('password_confirmation') }}     &lt;div class=&quot;form-actions&quot;&gt;   {{ Form::submit('Register', array('class' =&gt; 'btn btn-primary')) }}   &lt;\/div&gt;      {{ Form::close() }} @stop <\/code><\/pre>\n<p>  \u041e\u0442\u043c\u0435\u0447\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432:  <\/p>\n<ul>\n<li> \u041e\u0431\u044a\u0435\u043a\u0442 $error \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0438 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043e\u043a \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438, \u0442\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043f\u043e\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0443\u0441\u0442\u044b\u043c<\/li>\n<li> \u0421\u0443\u0444\u0444\u0438\u043a\u0441 _confirmation \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0447\u0442\u043e \u043f\u043e\u043b\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044e \u0431\u0435\u0437 \u0441\u0443\u0444\u0444\u0438\u043a\u0441\u0430, \u0442.\u0435. \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0447\u0442\u043e \u043f\u0430\u0440\u043e\u043b\u044c \u043e\u0431\u0430 \u0440\u0430\u0437\u0430 \u0431\u044b\u043b \u0432\u0432\u0435\u0434\u0435\u043d \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e<\/li>\n<\/ul>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u043a \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 POST \u0434\u0430\u043d\u043d\u044b\u0445:  <\/p>\n<pre><code class=\"php\">Route::post('\/user\/register', function() {     $validator = Validator::make(         Input::all(),         array(             'name' =&gt; array('required', 'min:5'),             'email' =&gt; array('required', 'email', 'unique:users'),             'password' =&gt; array('required', 'confirmed')         )     );       if ($validator-&gt;passes()) {         $user = new User();         $user-&gt;name     = Input::get('name');         $user-&gt;email    = Input::get('email');         $user-&gt;password = Hash::make(Input::get('password'));         $user-&gt;save();           $role_pending = Role::where('name', '=', 'pending')-&gt;first();         $user-&gt;roles()-&gt;attach($role_pending);           Auth::login($user);         return Redirect::to('\/')-&gt;with(             'success',             'Welcome to the site, . Auth::user()-&gt;name . '!'         );     }     else {         return Redirect::to('user\/register')-&gt;with(             'error',             'Please correct the following errors:'         )-&gt;withErrors($validator);     } }); <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431. \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0435\u043c\u0443 POST \u0434\u0430\u043d\u043d\u044b\u0435 (Input::all()) \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438. \u0415\u0441\u043b\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0448\u043b\u0430, \u0442\u044b \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u0435\u043c\u0443 \u0440\u043e\u043b\u0438, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u043c, \u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443.<br \/>  \u0415\u0441\u043b\u0438 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u0442\u043e \u043c\u044b \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043d\u0430 \u0444\u043e\u0440\u043c\u0443, \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435, \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u043e\u0442 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438\u0437 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 $errors.<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0448\u0430\u0433 \u0437\u0430 \u0448\u0430\u0433\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438 \u00ab\u0441\u043a\u0435\u043b\u0435\u0442\u00bb \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043b\u0430\u0442\u043d\u044b\u043c\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430\u043c\u0438. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c Recurly \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u043e\u043a.   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/195690\/\"> http:\/\/habrahabr.ru\/post\/195690\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">       \u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043f\u043b\u0430\u0442\u0435\u0436\u0435 \u044d\u0442\u043e \u043b\u0435\u0433\u043a\u043e, \u043d\u043e \u043d\u0435 \u0442\u0430\u043a \u043b\u0435\u0433\u043e\u043a \u043f\u0440\u0438\u0435\u043c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439. \u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e. \u0412\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0440\u0435\u0448\u0438\u0442\u044c, \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043e\u0442\u043a\u0430\u0437\u044b, \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043b\u0430\u0442\u0435\u0436\u0430\u0445 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b, \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435. \u0418 \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441\u0430\u043c\u044b\u0439 \u0432\u0430\u0436\u043d\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441 \u2014 \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0432\u043e\u0438\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u043a\u0443\u0440\u0441\u0435 \u043f\u043b\u0430\u0442\u0435\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435.<br \/>  \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, Recurly \u2014 \u044d\u0442\u043e \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f JavaScript-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u044b \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043b\u0430\u0442\u0435\u0436\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0435 \u0432 \u0441\u0435\u0431\u044f \u0432\u0441\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043b\u0430\u0442\u0435\u0436\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u044b.<br \/>  \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0432\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438 \u0441\u0443\u043c\u043c\u0443 \u0438 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439, Recurly \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u0441\u044f \u043e \u0440\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0438 \u043f\u0440\u0438\u043d\u044f\u0442\u0438\u0438 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439, \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0438\u0441\u0430\u043d. Recurly, \u0442\u0430\u043a\u0436\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u0440\u0438\u0444\u043d\u044b\u0445 \u043f\u043b\u0430\u043d\u043e\u0432, \u0440\u0430\u0441\u0447\u0435\u0442\u043e\u0432, \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u0438 \u0438 \u0432\u044b\u0447\u0435\u0442\u043e\u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439.<br \/>  \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0437 \u0434\u0432\u0443\u0445, \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u0412\u0430\u043c \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043b\u0430\u0442\u043d\u0443\u044e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0430\u0439\u0442, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 php-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Laravel \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u0440\u0438\u0435\u043c\u0430 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439 Recurly. \u041c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0430\u0439\u0442\u0430 \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0435\u0439, \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0438 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u0417\u0430\u0442\u0435\u043c \u043c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043f\u043b\u0430\u0442\u0435\u0436\u0435\u0439, \u0441\u0432\u044f\u0436\u0435\u043c \u0435\u0451 \u0441 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c \u043f\u043e\u043a\u0443\u043f\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0430\u0440\u0438\u0444\u043d\u044b\u0435 \u043f\u043b\u0430\u043d\u044b.<\/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-195690","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/195690","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=195690"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/195690\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=195690"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=195690"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=195690"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}