У меня с трудом работает с Laravel 4 Метод Auth :: попытка, следуйте правильной документации, читайте пару SO-потоков, но все же я не могу заставить ее работать.Laravel 4 Auth: попытка не работает
$userData = array('email' => '[email protected]','password' => 'admin');
if(Auth::attempt($userData)){
// redirect
}
else{
echo 'Invalid';
}
И это возвращает Invalid каждый раз
Теперь я не уверен, что это истинная причина.
В моей конфигурации/auth.php я следующий
<?php
return array(
/*
|--------------------------------------------------------------------------
| Default Authentication Driver
|--------------------------------------------------------------------------
|
| This option controls the authentication driver that will be utilized.
| This drivers manages the retrieval and authentication of the users
| attempting to get access to protected areas of your application.
|
| Supported: "database", "eloquent"
|
*/
'driver' => 'eloquent',
/*
|--------------------------------------------------------------------------
| Authentication Model
|--------------------------------------------------------------------------
|
| When using the "Eloquent" authentication driver, we need to know which
| Eloquent model should be used to retrieve your users. Of course, it
| is often just the "User" model but you may use whatever you like.
|
*/
'model' => 'User',
/*
|--------------------------------------------------------------------------
| Authentication Table
|--------------------------------------------------------------------------
|
| When using the "Database" authentication driver, we need to know which
| table should be used to retrieve your users. We have chosen a basic
| default value but you may easily change it to any table you like.
|
*/
'table' => 'users',
/*
|--------------------------------------------------------------------------
| Password Reminder Settings
|--------------------------------------------------------------------------
|
| Here you may set the settings for password reminders, including a view
| that should be used as your password reminder e-mail. You will also
| be able to set the name of the table that holds the reset tokens.
|
*/
'reminder' => array(
'email' => 'emails.auth.reminder', 'table' => 'password_reminders',
),
);
?>
Ive сказал вам ответ на ваш вопрос, сделайте все, что хотите. Ваши ключи массива ошибочны, учетная запись yoyur будет продолжать сбой. повеселись. – CreativityKills
вам не следует беспокоиться о даун-голосованиях, dnt u думаю, если вы попробовали несколько комбинаций, также электронная почта или имя пользователя не являются обязательным вариантом по крайней мере в laravel4, http://laravel.com/docs/security.Прочтите этот документ, чтобы лучше понять .... –
Я думаю, вы хотели бы связаться с [Документация Laravel 4.] (Http://four.laravel.com/docs/security) Я столкнулся с подобной проблемой прямо сейчас , Я постараюсь опубликовать здесь, как только выясню это. –