1
我正在嘗試執行基本身份驗證,並且遇到很多問題,最主要的是這call_user_func_array()期望參數1是一個有效的回調,類'Illuminate Auth Guard'沒有方法'attemptsp' - Laravel中的身份驗證
這個錯誤,當我發送的形式,並嘗試驗證
刀片
{{ Form::open(array('url' => 'usuario')) }}
<input type="text" class="text" id="email" name="email" placeholder="Correo" {{(Input::old('email')) ? 'value ="'. Input::old('email').'"' : '' }}>
<p>{{ $errors->first('email') }}</p>
<input type="text" class="text" id="password" name="password" placeholder="Contraseña" >
<p>{{ $errors->first('password') }}</p>
{{ Form::submit('Ingresar', array('class' => 'bg1')) }}
{{ Form::close() }}
路線
Route::post('usuario', array('as' => 'usuario', 'uses' => '[email protected]'));
模型
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
class Usuario extends Eloquent implements UserInterface, RemindableInterface{
protected $table = 'Usuario';
protected $primaryKey = 'idUsuario';
protected $hidden = array('Contrasena');
protected $fillable = array(
'Nombre',
'Apellido',
'Tipo',
'Contrasena',
'Correo',
'Fono',
'Foto'
);
}
控制器
class UsuarioController extends BaseController{
public function doLogin(){
$rules = array(
'email' => 'required|email',
'password' => 'required'
);
$validator = Validator::make(Input::all(), $rules);
if($validator->fails()){
return Redirect::to('usuario')->withErrors($validator)->withInput(Input::except('password'));
}else{
$userdata = array(
'Correo' => Input::get('email'),
'Password' => Input::get('password')
);
if(Auth::attemp($userdata)){
return View::make('hello');
}else{
return Redirect::to('usuario');
}
}
}
}
驗證
'driver' => 'database',
'model' => 'Usuario',
'table' => 'Usuario',
請問我該如何解決?
JAJAJA謝,層8:d – cheloncio