Can't login users in Laravel 4 -


i try create login system in laravel 4. this, use auth build in it. first off, didn't create register page yet, created user inside db. password, used

echo hash::make('password');

it gave me hash, pasted in in pass field. now, want log user in. this, created route:

route::post('/users/login/try', array('as' => 'logintry'), function() {     $user = array(         'name' => input::get('user'),         'pass' => hash::make(input::get('pass'))     );      if(auth::attempt($user,true)) {         return redirect::intended('dashboard');     } else {         return redirect::to('/users/login');     } }); 

and view:

{{ form::open(array('route' => 'logintry')) }} <p>{{ form::label('user','nazwa użytkownika') }} {{ form::text('user') }}</p> <p>{{ form::label('pass','hasło') }} {{ form::password('pass') }}</p> <p>{{ form::submit('zaloguj') }}</p> {{ form::close() }} 

when try submit form, get

call_user_func_array() expects parameter 1 valid callback, no array or string given 

what did wrong?

you're giving callback third parameter. move inside array , work.

route::post('/users/login/try', array('as' => 'logintry', function() {     //your callback code here. })); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -