当前位置: 首页>>代码示例>>PHP>>正文


PHP Member::create方法代码示例

本文整理汇总了PHP中app\Member::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::create方法的具体用法?PHP Member::create怎么用?PHP Member::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Member的用法示例。


在下文中一共展示了Member::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     for ($i = 0; $i < 20; $i++) {
         Member::create(['name' => "Member {$i}", 'email' => "member{$i}@gmail.com", 'phone' => "phone {$i}", 'country' => "country {$i}"]);
     }
 }
开发者ID:niscp,项目名称:To-do-app-with-Laravel-LAMP-Stack,代码行数:12,代码来源:MemberTableSeeder.php

示例2: getCurrentMember

 /**
  * Returns the current member based on the session id
  * @return Member
  */
 private function getCurrentMember()
 {
     if (!$this->currentMember && !($this->currentMember = Member::currentMember()->first())) {
         $this->currentMember = Member::create(['session_id' => \Session::getId()]);
     }
     return $this->currentMember;
 }
开发者ID:Sparclex,项目名称:studie,代码行数:11,代码来源:SurveyController.php

示例3: testDeleteMember

 /**
  * Fonction permettant de tester la
  * suppression d'un membre d'un projet
  *
  * @return void
  */
 public function testDeleteMember()
 {
     Member::create(["project_id" => 2, "Developer_id" => 2]);
     $cnt = new MemberController();
     $cnt->remove(2, 2);
     $this->assertEquals(null, Member::where("project_id", 2)->where("Developer_id", 2)->get()->first());
 }
开发者ID:hardwork2015,项目名称:cdp,代码行数:13,代码来源:DeleteMemberTest.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     DB::table('member')->delete();
     Member::create(['account' => 'derrick', 'nick' => 'mikcy', 'name' => '张三', 'mobile' => '13819887634', 'gender' => 0, 'age' => 34, 'email' => '6131300@qq.com', 'password' => Hash::make('123')]);
     Member::create(['account' => 'derrick2', 'nick' => 'mikcy2', 'name' => '李四', 'mobile' => '11819887634', 'gender' => 1, 'age' => 32, 'email' => '16131300@qq.com', 'password' => Hash::make('123')]);
     Member::create(['account' => 'derrick3', 'nick' => 'micky3', 'name' => '王五', 'mobile' => '13829887634', 'gender' => 1, 'age' => 26, 'email' => '61311300@qq.com', 'password' => Hash::make('1223')]);
 }
开发者ID:xubodreamsky,项目名称:wadmin,代码行数:13,代码来源:MemberTableSeeder.php

示例5: register

 function register($input)
 {
     foreach ($input as $key => $value) {
         $this->checkEmpty($key, $value);
     }
     $user = User::create(['first_name' => $input['first_name'], 'last_name' => $input['last_name'], 'email' => $input['email'], 'password' => Hash::make($input['password'])]);
     $organization = Organization::OfName($input['organization_name'])->first();
     Member::create(['user_id' => $user->id, 'organization_id' => $organization->id]);
 }
开发者ID:sandyp143,项目名称:attendance-system,代码行数:9,代码来源:User.php

示例6: create

 public function create(Request $request)
 {
     $filename = '';
     if ($request->hasFile('photo')) {
         $filename = md5('photo' . uniqid()) . "." . $request->file('photo')->guessExtension();
         $request->file('photo')->move(__DIR__ . "/../../../public/uploads", $filename);
     }
     $article = Member::create(['full_name' => $request->get('full_name'), 'role' => $request->get('role'), 'photo' => $filename, 'birthday' => new \DateTime($request->get('birthday')), 'short_description' => $request->get('short_description'), 'description' => $request->get('description'), 'command_id' => $request->get('command_id')]);
     return response()->json($article, 201);
 }
开发者ID:valiknet18,项目名称:FootballNewsApp,代码行数:10,代码来源:MembersController.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $inputArr = Input::all();
     $socialSiteArr = $inputArr['site'];
     $categoryIdArr = $inputArr['category_id'];
     $inputArr = array_except($inputArr, array('site', 'category_id'));
     $memberObj = Member::create($inputArr);
     Member::saveMemberSocialIds($socialSiteArr, $memberObj->id);
     Member::saveMemberCategoryIds($categoryIdArr, $memberObj->id);
     return Redirect::route('members.edit', [$memberObj->id])->with('message', 'Member added.');
 }
开发者ID:nowarena,项目名称:laravel,代码行数:16,代码来源:MembersController.php

示例8: add

 public function add(NewMemberRequest $r, $project_id)
 {
     try {
         $Developer_id = Developer::where("email", $r->input("email"))->get()->first()->id;
         if ($Developer_id != null) {
             Member::create(["Developer_id" => $Developer_id, "project_id" => $project_id]);
         }
     } catch (\Illuminate\Database\QueryException $e) {
     }
     $members = DB::table('member')->where('project_id', $project_id)->join('Developer', 'member.Developer_id', '=', 'Developer.id')->get();
     return view("member.show")->with('members', $members)->with('project_id', $project_id);
 }
开发者ID:hardwork2015,项目名称:cdp,代码行数:12,代码来源:MemberController.php

示例9: create

 public function create(Request $request)
 {
     $rules = array('email' => 'required|email', 'password' => 'required', 'confirm' => 'required|same:password');
     $validator = \Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         return Response::json(array('result' => false, 'message' => $validator->errors()->all()));
     } else {
         $email = $request->input('email');
         $a = Member::where('email', $email)->count();
         if ($a > 0) {
             return Response::json(array('result' => false, 'message' => array('Email นี้ ถูกใช้แล้ว')));
         }
         $member = Member::create(['email' => $request->input('email'), 'name' => $request->input('email'), 'password' => md5($request->input('password')), 'fullname' => $request->input('fullname'), 'phone' => $request->input('phone'), 'address' => $request->input('address'), 'province_id' => $request->input('province_id'), 'amphur_id' => $request->input('amphur_id'), 'district_id' => $request->input('district_id'), 'zipcode_id' => $request->input('zipcode_id'), 'status' => 1]);
         return Response::json(array('result' => true, 'message' => $member));
     }
 }
开发者ID:snookerjirayut,项目名称:unotoon-member,代码行数:16,代码来源:AuthCustomController.php

示例10: postRegister

	public function postRegister(){
        $validator = Validator::make($this->request->all(), [
			'username'=>'required|unique:member,username|min:10|max:20',
			'password'=>'required|min:10|max:20',
			'secretquestion'=>'required|min:10|max:100',
			'secretanswer'=>'required|min:1|max:100',
            'captcha' => 'required|captcha'
        ],['captcha.captcha'=>'Your captcha is invalid.']);
        if ($validator->fails()){
        	return view('login')->with('cart',$this->getCart())
        						->with('ferrors',$validator->errors())
        						->with('username',$this->request->input('username'))
        						->with('secretquestion',$this->request->input('secretquestion'))
        						->with('secretanswer',$this->request->input('secretanswer'));
        }else{
			Member::create($this->request->all());
			return view('login')->with('cart',$this->getCart())
								->with('success','Your account is successful created.');
        }
	}
开发者ID:simplylouis,项目名称:online_book_shop_20151110_laravel_5,代码行数:20,代码来源:MemberController.php

示例11: store

 public function store(Request $request)
 {
     if (!Auth::check()) {
         return response()->json($this->notLoginJson, 401);
     } else {
         $user = Auth::user();
         if (!$user->hasRole('admin')) {
             return response()->json($this->needPermissionsJson, 401);
         }
     }
     $data = $request->only('first_name', 'last_name', 'email', 'phone', 'ci');
     $validatorRules = ['first_name' => 'required', 'last_name' => 'required', 'ci' => 'required|unique:members'];
     $validator = Validator::make($data, $validatorRules, $this->validatorMessages);
     if ($validator->fails()) {
         $errorsMessages = $validator->errors()->all();
         return response()->json(['message' => $errorsMessages[0]], 400);
     } else {
         $newMember = Member::create($data);
         return response()->json($newMember);
     }
 }
开发者ID:pedronalbert,项目名称:lions-server,代码行数:21,代码来源:MemberController.php

示例12: 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

示例13: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $recordId = 0;
     $initialPostingId = 0;
     // Deal with the context data
     $context = $this->getContextDefaults();
     if ($request->has('context')) {
         $postDataContext = $request->input('context');
         if (array_key_exists('name', $postDataContext)) {
             $contextDefaults = $this->getContextDefaults($postDataContext['name']);
         } else {
             $contextDefaults = $this->getContextDefaults();
         }
         if (array_key_exists('hasOverrides', $postDataContext)) {
             $massOverrideKeys = ['newRank', 'newPlatoon', 'newPosting'];
             foreach ($massOverrideKeys as $overrideKey) {
                 if (array_key_exists($overrideKey, $postDataContext)) {
                     $contextDefaults[$overrideKey] = $postDataContext[$overrideKey];
                 }
             }
             if (array_key_exists('thisYear', $postDataContext)) {
                 $contextDefaults['thisYear'] = substr($postDataContext['thisYear'], 2, 2);
             }
             if (array_key_exists('thisCycle', $postDataContext)) {
                 $contextDefaults['thisCycle'] = substr($postDataContext['thisCycle'], 0, 1);
             }
         }
         $context = $contextDefaults;
     }
     if ($request->has('member')) {
         // Deal with the member data
         $postDataMember = $request->input('member');
         DB::beginTransaction();
         try {
             // Get their regimental number
             $newRegtNum = $this->generateStandardRegtNumber($context) . ($postDataMember['sex'] == 'F' ? 'F' : '');
             if (!empty($newRegtNum)) {
                 // Assign regt num, create new record, and generate initial posting
                 $postDataMember['regt_num'] = $newRegtNum;
                 $newMember = Member::create($postDataMember);
                 if ($newMember->regt_num > 0) {
                     $recordId = $newMember->regt_num;
                     $initialPostingId = $this->generateInitialPostingRecord($recordId, $context);
                 } else {
                     // $error = [
                     // 'code' => 'CANNOT_SAVE_REGT_NUM',
                     // 'valueExpected' => $newRegtNum,
                     // 'valueActual' => $newMember->regt_num,
                     // 'reason' => 'Looks like the database rejected this regt num'];
                     throw new \Exception('Looks like the database rejected this regt num. ' . "Value Expected: {$newRegtNum}, Value Actual: {$newMember->regt_num}", ResponseCodes::ERR_REGT_NUM);
                 }
             } else {
                 throw new Exception('Could not generate a regt num', ResponseCodes::ERR_REGT_NUM);
             }
             DB::commit();
             return response()->json(['recordId' => $recordId, 'initialPostingId' => $initialPostingId]);
         } catch (\Exception $ex) {
             DB::rollBack();
             return response()->json(['error' => ['code' => $ex->getCode(), 'reason' => $ex->getMessage()]], 500);
         }
     }
     return response()->json(['error' => ['code' => ResponseCodes::ERR_POSTDATA_MISSING, 'reason' => 'Member postdata missing']], 400);
 }
开发者ID:alansfyeung,项目名称:FLARES,代码行数:69,代码来源:MemberController.php

示例14: run

 public function run()
 {
     Member::create(['id' => '1', 'user_id' => User::where('lname', 'Macaraig')->first()->id, 'comm_id' => '7', 'event_id' => Committee::where('id', '7')->first()->event_id]);
     Member::create(['id' => '2', 'user_id' => User::where('lname', 'Fernandez')->first()->id, 'comm_id' => '8', 'event_id' => Committee::where('id', '8')->first()->event_id]);
     Member::create(['id' => '3', 'user_id' => User::where('lname', 'Cabarles')->first()->id, 'comm_id' => '8', 'event_id' => Committee::where('id', '8')->first()->event_id]);
     Member::create(['id' => '4', 'user_id' => User::where('lname', 'Bautista')->first()->id, 'comm_id' => '9', 'event_id' => Committee::where('id', '9')->first()->event_id]);
     Member::create(['id' => '5', 'user_id' => User::where('lname', 'Silvania')->first()->id, 'comm_id' => '10', 'event_id' => Committee::where('id', '10')->first()->event_id]);
     Member::create(['id' => '6', 'user_id' => User::where('lname', 'Cepe')->first()->id, 'comm_id' => '11', 'event_id' => Committee::where('id', '11')->first()->event_id]);
     Member::create(['id' => '7', 'user_id' => User::where('lname', 'Bawanan')->first()->id, 'comm_id' => '12', 'event_id' => Committee::where('id', '12')->first()->event_id]);
     Member::create(['id' => '8', 'user_id' => User::where('lname', 'Clemente')->first()->id, 'comm_id' => '12', 'event_id' => Committee::where('id', '12')->first()->event_id]);
     Member::create(['id' => '9', 'user_id' => User::where('lname', 'Caymo')->first()->id, 'comm_id' => '11', 'event_id' => Committee::where('id', '11')->first()->event_id]);
     Member::create(['id' => '10', 'user_id' => User::where('lname', 'Sibal')->first()->id, 'comm_id' => '10', 'event_id' => Committee::where('id', '10')->first()->event_id]);
     Member::create(['id' => '11', 'user_id' => User::where('lname', 'Rupa')->first()->id, 'comm_id' => '10', 'event_id' => Committee::where('id', '10')->first()->event_id]);
     Member::create(['id' => '12', 'user_id' => User::where('lname', 'Pastores')->first()->id, 'comm_id' => '10', 'event_id' => Committee::where('id', '10')->first()->event_id]);
     Member::create(['id' => '13', 'user_id' => User::where('lname', 'Ware')->first()->id, 'comm_id' => '12', 'event_id' => Committee::where('id', '12')->first()->event_id]);
     $this->call('FinancialStatusesTableSeeder');
 }
开发者ID:zoekayvee,项目名称:YSESTracker,代码行数:17,代码来源:DatabaseSeeder.php

示例15: create

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return Member::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }
开发者ID:nikotaman01,项目名称:PenGumin,代码行数:10,代码来源:AuthController.php


注:本文中的app\Member::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。