本文整理汇总了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}"]);
}
}
示例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;
}
示例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());
}
示例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')]);
}
示例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]);
}
示例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);
}
示例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.');
}
示例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);
}
示例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));
}
}
示例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.');
}
}
示例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);
}
}
示例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.');
}
示例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);
}
示例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');
}
示例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'])]);
}