本文整理匯總了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.');
}