当前位置: 首页>>代码示例>>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;未经允许,请勿转载。