當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Member::rules方法代碼示例

本文整理匯總了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.');
 }
開發者ID:CUMSA,項目名稱:members,代碼行數:12,代碼來源:ProfileController.php

示例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.');
 }
開發者ID:CUMSA,項目名稱:members,代碼行數:24,代碼來源:SignupController.php


注:本文中的app\Member::rules方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。