0
가 아닌 객체() 멤버 함수에 전달 호출 4.Laravel 4 오류 : Laravel에 경로 :: 게시물을 사용할 때이 문제가
이 내 User.php (laravel 모델) 코드입니다 :
class User extends Eloquent implements UserInterface, RemindableInterface {
public static function validate($input)
{
$rules = array(
'email' => 'Required|Between:3,64|Email|Unique:users',
'password' => 'Required|AlphaNum|Between:4,8|Confirmed',
'password_confirmation' => 'Required|AlphaNum|Between:4,8'
);
$v = Validator::make($input, $rules);
}
}
이 내 routes.php 코드 :
@section('content')
{{ Form::open(array('url' => '/register', 'method' => 'post')) }}
{{ Form::text('email') }}
{{ Form::label('email', 'Your Email') }}</br>
{{ Form::password('password'); }}
{{ Form::label('password', 'Your Password') }}</br>
{{ Form::password('password_confirmation'); }}
{{ Form::label('password_confirmation', 'Confirm Your Password') }}</br>
{{ Form::submit('Go') }}
{{ Form::close() }}
@stop
: 이것은 내 register_user.blade.php 코드가
Route::post('register', function()
{
$v = User::validate(Input::all());
if ($v->passes()){
$u = new User();
$u->email = Input::get('email');
$u->password = Hash::make(Input::get('password'));
$u->save();
Auth::login($u);
return Redirect::to('createprofile');
}
else{
return Redirect::to('register')->withErrors($v->getMessageBag());
}
});
입니다
문제는 대신 비에 나에게 멤버 함수를 호출 전달()를주는 형태가 유효한 개체로
$v = User::validate(Input::all())
를 인식하지 않는 경로 :: 게시물에 제출하면 될 것 같다 목적.
var_dump($v)
은 null과 같습니다.
누구든지이 문제가 무엇인지 알 수 있습니까? User :: validate()는 User 모델에서 함수를 호출하는 올바른 방법입니까?
고마워요. 나는 실제로 이것을 깨달았고, 알아 냈다고 말하려고했지만 어쨌든 빠른 응답을 주셔서 감사합니다;) –
[this] (http://stackoverflow.com/questions/40100906/code-will-be-execute)를 확인하십시오. - 또는 - 유효성 검사 실패 - 실패 - laravel), 도움이 필요합니다. –