本文整理汇总了PHP中app\Member::rules方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::rules方法的具体用法?PHP Member::rules怎么用?PHP Member::rules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Member
的用法示例。
在下文中一共展示了Member::rules方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save(Request $request)
{
$form = $this->form(UpdateProfileForm::class);
$form->validate(Member::rules('profile', false), ['nricformat' => 'NRIC checksum failed. Try checking it again.', 'dateformat' => 'Date should be a valid date of the format YYYY-MM-DD']);
if (!$form->isValid()) {
return redirect()->back()->with('alert-warning', 'Error in form input!')->withErrors($form->getErrors())->withInput();
}
$user = Auth::user();
// get the first member where the crsid matches and update the model
$person = Auth::user()->member->update($request->all());
return redirect()->route('member.profile')->with('alert-success', 'Profile updated.');
}
示例2: saveFresher
public function saveFresher(Request $request)
{
$form = $this->form(FreshersSignupForm::class);
$form->validate(Member::rules('fresher', true), ['nricformat' => 'NRIC checksum failed. Try checking it again.']);
if (!$form->isValid()) {
return redirect()->back()->withErrors($form->getErrors())->withInput()->with('alert-warning', 'Error in form input!');
}
$fresher = Member::create($request->all());
$fresher->membership_type = 'Non-member';
$fresher->registration_time = null;
$fresher->save();
if ($request->input('family_join') === '1') {
// Save CUMSA family preference.
$family_request = new FamilyRequest();
$family_request->member()->associate($fresher);
$family_request->type = 'Child';
$family_request->save();
}
Mail::send('emails.signup', ['user' => $fresher], function ($m) use($fresher) {
$m->from('database@cumsa.org', 'CUMSA');
$m->to($fresher->email_other, $fresher->first_name)->subject('[CUMSA] Thanks for signing up!');
});
return redirect()->route('member.signup.fresher')->with('alert-success', 'Thanks ' . $fresher->first_name . '! You have successfully signed up.');
}