{"id":189,"date":"2012-11-29T13:32:00","date_gmt":"2012-11-29T06:32:00","guid":{"rendered":"http:\/\/ethaizone.com\/blog\/?p=189"},"modified":"2012-11-29T14:24:19","modified_gmt":"2012-11-29T07:24:19","slug":"%e0%b8%a3%e0%b8%b0%e0%b8%9a%e0%b8%9a%e0%b8%a5%e0%b9%87%e0%b8%ad%e0%b8%81%e0%b8%ad%e0%b8%b4%e0%b8%99%e0%b8%9a%e0%b8%99-laravel","status":"publish","type":"post","link":"https:\/\/ethaizone.me\/blog\/2012\/11\/%e0%b8%a3%e0%b8%b0%e0%b8%9a%e0%b8%9a%e0%b8%a5%e0%b9%87%e0%b8%ad%e0%b8%81%e0%b8%ad%e0%b8%b4%e0%b8%99%e0%b8%9a%e0%b8%99-laravel\/","title":{"rendered":"\u0e17\u0e33\u0e23\u0e30\u0e1a\u0e1a\u0e25\u0e47\u0e2d\u0e01\u0e2d\u0e34\u0e19\u0e41\u0e1a\u0e1a\u0e42\u0e04\u0e23\u0e15\u0e07\u0e48\u0e32\u0e22\u0e1a\u0e19 Laravel"},"content":{"rendered":"<p>\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49\u0e2d\u0e31\u0e1e\u0e1a\u0e25\u0e47\u0e2d\u0e01\u0e2a\u0e31\u0e01\u0e2b\u0e19\u0e48\u0e2d\u0e22 \u0e01\u0e25\u0e31\u0e27\u0e23\u0e49\u0e32\u0e07\u00a0 <img src=\"http:\/\/ethaizone.me\/blog\/wp-includes\/images\/smilies\/1_002.gif\" alt=\"\/XD\" class=\"wp-smiley\" style=\"height: 1em; max-height: 1em;\" \/> \u0e27\u0e31\u0e19\u0e19\u0e35\u0e49\u0e1c\u0e21\u0e08\u0e30\u0e1e\u0e39\u0e14\u0e16\u0e36\u0e07\u0e23\u0e30\u0e1a\u0e1a\u0e25\u0e47\u0e2d\u0e01\u0e2d\u0e34\u0e19 \u0e0b\u0e36\u0e48\u0e07\u0e40\u0e1b\u0e47\u0e19\u0e23\u0e30\u0e1a\u0e1a\u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e40\u0e02\u0e35\u0e22\u0e19\u0e01\u0e31\u0e19\u0e21\u0e31\u0e19\u0e17\u0e38\u0e01\u0e07\u0e32\u0e19\u0e2d\u0e22\u0e39\u0e48\u0e41\u0e25\u0e49\u0e27 \u0e17\u0e35\u0e48\u0e08\u0e30\u0e40\u0e02\u0e35\u0e22\u0e19\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49\u0e40\u0e1b\u0e47\u0e19\u0e23\u0e30\u0e1a\u0e1a\u0e42\u0e04\u0e23\u0e15\u0e07\u0e48\u0e32\u0e22\u0e41\u0e15\u0e48\u0e2a\u0e1a\u0e32\u0e22\u0e2a\u0e38\u0e14\u0e46 \u0e01\u0e48\u0e2d\u0e19\u0e2d\u0e37\u0e48\u0e19\u0e1c\u0e21\u0e44\u0e21\u0e48\u0e40\u0e2d\u0e48\u0e22\u0e1e\u0e37\u0e49\u0e19\u0e2d\u0e30\u0e44\u0e23\u0e21\u0e32\u0e01\u0e21\u0e32\u0e22 \u0e40\u0e23\u0e34\u0e48\u0e21\u0e01\u0e31\u0e19\u0e40\u0e25\u0e22<\/p>\n<p>1. \u0e2a\u0e34\u0e48\u0e07\u0e17\u0e35\u0e48\u0e04\u0e38\u0e13\u0e15\u0e49\u0e2d\u0e07\u0e21\u0e35\u0e04\u0e37\u0e2d\u0e10\u0e32\u0e19\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e15\u0e32\u0e23\u0e32\u0e07 users \u0e01\u0e31\u0e1a\u0e42\u0e21\u0e40\u0e14\u0e25\u0e15\u0e32\u0e21\u0e21\u0e32\u0e15\u0e23\u0e10\u0e32\u0e19 Eloquent \u0e40\u0e25\u0e22 \u0e04\u0e37\u0e2d\u00a0\u0e21\u0e35\u0e1f\u0e34\u0e25\u0e14\u0e4c id, username \u0e2b\u0e23\u0e37\u0e2d email (\u0e08\u0e30\u0e21\u0e35\u0e17\u0e31\u0e49\u0e07\u0e04\u0e39\u0e48\u0e01\u0e47\u0e44\u0e14\u0e49) \u0e41\u0e25\u0e30 password \u0e40\u0e23\u0e37\u0e48\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e42\u0e21\u0e40\u0e14\u0e25\u0e2b\u0e32\u0e2d\u0e48\u0e32\u0e19\u0e44\u0e14\u0e49\u0e17\u0e35\u0e48\u0e40\u0e27\u0e47\u0e1a Laravel \u0e40\u0e25\u0e22\u0e04\u0e23\u0e31\u0e1a \u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32\u0e01\u0e32\u0e23\u0e15\u0e34\u0e14\u0e15\u0e48\u0e2d\u0e10\u0e32\u0e19\u0e02\u0e49\u0e2d\u0e21\u0e39\u0e25\u0e43\u0e2b\u0e49\u0e40\u0e2a\u0e23\u0e47\u0e08\u0e14\u0e49\u0e27\u0e22\u0e19\u0e30\u0e04\u0e23\u0e31\u0e1a<\/p>\n<p>2.\u0e01\u0e33\u0e2b\u0e19\u0e14 route.php \u0e15\u0e32\u0e21\u0e19\u0e35\u0e49\u0e40\u0e25\u0e22<\/p>\n<pre class=\"brush:php\">Route::any('\/user\/login', 'user@login');<\/pre>\n<p>3. \u0e2a\u0e23\u0e49\u0e32\u0e07 controller \u0e0a\u0e37\u0e48\u0e2d user.php \u0e41\u0e25\u0e49\u0e27\u0e01\u0e47\u0e15\u0e32\u0e21\u0e19\u0e35\u0e49\u0e40\u0e25\u0e22<\/p>\n<pre class=\"brush:php\">&lt;?php\r\n\r\nclass User_Controller extends Base_Controller {\r\n\r\n\tpublic $restful = true;\r\n\r\n\tpublic function __construct() {\r\n\t\tparent::__construct();\r\n\t}\r\n\r\n\tpublic function get_login()\r\n\t{\r\n\t\treturn View::make('user.login')-&gt;with('error', Session::get('error'));\r\n\t}\r\n\r\n\tpublic function post_login()\r\n\t{\r\n\t\t$userinfo = array(\r\n\t\t\t'username'    =&gt; strtolower(Input::get('email')),\r\n\t\t\t'password'     =&gt; Input::get('password'),\r\n\t\t\t'remember'    =&gt; Input::get('remember')\r\n\t\t);\r\n\r\n\t\tif ( Auth::attempt($userinfo) )\r\n\t\t{\r\n\t\t\treturn Redirect::home();\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\treturn Redirect::to('user\/login')\r\n\t\t\t\t -&gt;with('error', '\u0e2d\u0e35\u0e40\u0e21\u0e25\u0e4c\u0e2b\u0e23\u0e37\u0e2d\u0e23\u0e2b\u0e31\u0e2a\u0e1c\u0e48\u0e32\u0e19\u0e44\u0e21\u0e48\u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07')\r\n\t\t\t\t-&gt;with_input();\r\n\t\t}\r\n\t}\r\n\r\n}<\/pre>\n<p>4. \u0e2a\u0e23\u0e49\u0e32\u0e07 view user\/login.blade.php<\/p>\n<pre class=\"brush:php\">&lt;div class=\"span8 offset2 well\"&gt;\r\n\t&lt;h2&gt;\u0e40\u0e02\u0e49\u0e32\u0e2a\u0e39\u0e48\u0e23\u0e30\u0e1a\u0e1a&lt;\/h2&gt;\r\n\t&lt;hr \/&gt;\r\n\t{{ Form::open(URL::current()) }}\r\n\r\n\t@if (!empty($error))\r\n\t\t&lt;div class=\"alert alert-error\"&gt;{{ $error }} &lt;\/div&gt;\r\n\t@endif\r\n\r\n\t&lt;div class=\"control-group\"&gt;\r\n\t\t{{ Form::label( 'email', '\u0e2d\u0e35\u0e40\u0e21\u0e25\u0e4c', array( 'class' =&gt; 'control-label')) }}\r\n\t\t&lt;div class=\"controls\"&gt;\r\n\t\t\t&lt;div class=\"input-prepend\"&gt;&lt;span class=\"add-on\"&gt;&lt;i class=\"icon-envelope\"&gt;&lt;\/i&gt;&lt;\/span&gt;\r\n\t\t\t\t{{ Form::text( 'email', Input::old( 'email')) }}\r\n\t\t\t&lt;\/div&gt;\r\n\t\t&lt;\/div&gt;\r\n\t&lt;\/div&gt;\r\n\r\n\t&lt;div class=\"control-group\"&gt;\r\n\t\t{{ Form::label( 'password', '\u0e23\u0e2b\u0e31\u0e2a\u0e1c\u0e48\u0e32\u0e19', array( 'class' =&gt; 'control-label')) }}\r\n\t\t&lt;div class=\"controls\"&gt;\r\n\t\t\t&lt;div class=\"input-prepend\"&gt;&lt;span class=\"add-on\"&gt;&lt;i class=\"icon-lock\"&gt;&lt;\/i&gt;&lt;\/span&gt;\r\n\t\t\t\t{{ Form::password( 'password') }}\r\n\t\t\t&lt;\/div&gt;\r\n\t\t&lt;\/div&gt;\r\n\t&lt;\/div&gt;\r\n\r\n\t&lt;div class=\"control-group\"&gt;\r\n\t\t&lt;div class=\"controls\"&gt;\r\n\t\t\t&lt;label class=\"checkbox\"&gt;\r\n\t\t\t\t{{ Form::checkbox( 'remember', '', Input::old('remember')) }} \u0e08\u0e14\u0e08\u0e33\u0e01\u0e32\u0e23\u0e25\u0e47\u0e2d\u0e01\u0e2d\u0e34\u0e19\r\n\t\t\t&lt;\/label&gt;\r\n\t\t&lt;\/div&gt;\r\n\t&lt;\/div&gt;\r\n\r\n\t&lt;div class=\"controls\"&gt;\r\n\t\t{{ Form::submit( '\u0e40\u0e02\u0e49\u0e32\u0e2a\u0e39\u0e48\u0e23\u0e30\u0e1a\u0e1a', array( 'class' =&gt; 'btn btn-success' ) ) }}\r\n\t&lt;\/div&gt;\r\n\r\n\t{{ Form::close() }}\r\n&lt;\/div&gt;<\/pre>\n<p>\u0e16\u0e49\u0e32\u0e1c\u0e21\u0e1e\u0e34\u0e21\u0e1e\u0e4c\u0e44\u0e21\u0e48\u0e1c\u0e34\u0e14 \u0e15\u0e32\u0e21\u0e19\u0e35\u0e49\u0e08\u0e30\u0e44\u0e14\u0e49\u0e23\u0e30\u0e1a\u0e1a\u0e25\u0e47\u0e2d\u0e01\u0e2d\u0e34\u0e19\u0e40\u0e2a\u0e23\u0e47\u0e08\u0e2a\u0e23\u0e23\u0e1e \u0e21\u0e35\u0e23\u0e30\u0e1a\u0e1a\u0e08\u0e14\u0e08\u0e33\u0e25\u0e47\u0e2d\u0e01\u0e2d\u0e34\u0e19\u0e14\u0e49\u0e27\u0e22 \u0e17\u0e35\u0e48\u0e40\u0e2b\u0e25\u0e37\u0e2d\u0e01\u0e47\u0e44\u0e1b\u0e14\u0e39\u0e46 \u0e01\u0e31\u0e19\u0e40\u0e2d\u0e07\u0e19\u0e30\u0e04\u0e23\u0e31\u0e1a \u0e27\u0e48\u0e32\u0e2d\u0e30\u0e44\u0e23\u0e40\u0e1b\u0e47\u0e19\u0e2d\u0e30\u0e44\u0e23 555+<\/p>\n<p>\u0e1b\u0e25. \u0e16\u0e49\u0e32\u0e2b\u0e19\u0e49\u0e32\u0e15\u0e32\u0e2d\u0e2d\u0e01\u0e21\u0e32\u0e41\u0e1b\u0e25\u0e01\u0e46 \u0e43\u0e2b\u0e49\u0e25\u0e07 bundle bootstrapper \u0e19\u0e30\u0e04\u0e23\u0e31\u0e1a \u0e40\u0e1e\u0e23\u0e32\u0e30\u0e1c\u0e21\u0e43\u0e0a\u0e49\u0e15\u0e31\u0e27\u0e19\u0e35\u0e49\u0e2d\u0e22\u0e39\u0e48\u0e04\u0e23\u0e31\u0e1a<br \/>\n\u0e1b\u0e252. \u0e08\u0e23\u0e34\u0e07\u0e46 \u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e40\u0e02\u0e35\u0e22\u0e19 controller \u0e43\u0e2b\u0e49\u0e2a\u0e31\u0e49\u0e19\u0e01\u0e27\u0e48\u0e32\u0e19\u0e35\u0e49\u0e44\u0e14\u0e49\u0e2d\u0e35\u0e01 \u0e41\u0e15\u0e48\u0e41\u0e1a\u0e1a\u0e02\u0e49\u0e32\u0e07\u0e1a\u0e19\u0e19\u0e35\u0e49\u0e08\u0e30\u0e04\u0e38\u0e21\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e44\u0e14\u0e49\u0e14\u0e35\u0e01\u0e27\u0e48\u0e32\u0e2b\u0e19\u0e48\u0e2d\u0e22\u0e04\u0e23\u0e31\u0e1a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49\u0e2d\u0e31\u0e1e\u0e1a\u0e25\u0e47\u0e2d\u0e01\u0e2a\u0e31\u0e01\u0e2b\u0e19\u0e48\u0e2d\u0e22 \u0e01\u0e25\u0e31\u0e27\u0e23\u0e49\u0e32\u0e07\u00a0 \u0e27\u0e31\u0e19\u0e19\u0e35\u0e49\u0e1c &hellip; <a href=\"https:\/\/ethaizone.me\/blog\/2012\/11\/%e0%b8%a3%e0%b8%b0%e0%b8%9a%e0%b8%9a%e0%b8%a5%e0%b9%87%e0%b8%ad%e0%b8%81%e0%b8%ad%e0%b8%b4%e0%b8%99%e0%b8%9a%e0%b8%99-laravel\/\">\u0e2d\u0e48\u0e32\u0e19\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e15\u0e34\u0e21 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[3,9],"tags":[],"class_list":["post-189","post","type-post","status-publish","format-standard","hentry","category-coding","category-laravel"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2Iqnv-33","jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/ethaizone.me\/blog\/wp-json\/wp\/v2\/posts\/189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ethaizone.me\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ethaizone.me\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ethaizone.me\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ethaizone.me\/blog\/wp-json\/wp\/v2\/comments?post=189"}],"version-history":[{"count":1,"href":"https:\/\/ethaizone.me\/blog\/wp-json\/wp\/v2\/posts\/189\/revisions"}],"predecessor-version":[{"id":197,"href":"https:\/\/ethaizone.me\/blog\/wp-json\/wp\/v2\/posts\/189\/revisions\/197"}],"wp:attachment":[{"href":"https:\/\/ethaizone.me\/blog\/wp-json\/wp\/v2\/media?parent=189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ethaizone.me\/blog\/wp-json\/wp\/v2\/categories?post=189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ethaizone.me\/blog\/wp-json\/wp\/v2\/tags?post=189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}