本文整理汇总了PHP中Alert::formError方法的典型用法代码示例。如果您正苦于以下问题:PHP Alert::formError方法的具体用法?PHP Alert::formError怎么用?PHP Alert::formError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alert
的用法示例。
在下文中一共展示了Alert::formError方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
public function send()
{
$data = Input::all();
$rules = ['full_name' => ['required', 'min:3', 'max:35'], 'email' => ['required', 'email'], 'content' => ['required', 'min:10', 'max:600']];
$validator = Validator::make($data, $rules);
if ($validator->fails()) {
return Alert::formError($validator);
}
Mailing::contact($data);
return Alert::flash(Lang::get('contact.sent'), 'success');
}
示例2: processForm
private function processForm($type, $data, $extra_rules)
{
$currentQuestion = Question::getCurrentQuestion();
$rules = ['question' => ['required', "in:{$currentQuestion['id']}"], 'option' => ['required', "in:{$currentQuestion['left_option']},{$currentQuestion['right_option']}"], 'post_type' => ['required', "in:{$type}"], 'title' => ['required', "min:10", "max:200"]];
foreach ($extra_rules as $field => $rule) {
$rules[$field] = $rule;
}
$validator = Validator::make($data, $rules);
if ($validator->fails()) {
return Alert::formError($validator);
}
$post = new Post();
$posted = $post->store($data, $type);
return Redirect::route('post', [$posted['id'], $posted['slug']])->with('flash_success', Lang::get('post.saved'));
}
示例3: register
public function register()
{
$data = Input::all();
$rules = ['first_name' => ['required', 'min:3', 'max:35'], 'last_name' => ['required', 'min:3', 'max:35'], 'username' => ['required', 'alpha_num', 'min:3', 'max:35', 'unique:users'], 'email' => ['required', 'email', 'max:128', 'unique:users'], 'picture' => ['sometimes', 'mimes:jpeg,gif,png', 'max:2048'], 'password' => ['required', 'min:6', 'confirmed']];
$validator = Validator::make($data, $rules);
if ($validator->fails()) {
return Alert::formError($validator);
}
$user = new User();
$user_id = $user->store($data);
$profile = new Profile();
$profile->store($data, $user_id, Input::hasFile('picture'));
$this->sendActivation($user_id, $data['email']);
Auth::login($user);
return Alert::activate($data['email']);
}
示例4: adminUpdateUser
public static function adminUpdateUser($id)
{
$data = Input::all();
$rules = ['email' => ['required', 'email', 'max:128', 'unique:users,email,' . Auth::id()], 'username' => ['required', 'min:5', 'max:15', 'alpha_num', 'unique:users,username,' . Auth::id()]];
$validator = Validator::make($data, $rules);
if ($validator->fails()) {
return Alert::formError($validator);
} else {
$user = new User();
$update = User::UpdateUser($id, $data);
return Alert::flash(Lang::get('admin.user-updated'), 'success');
}
}