示例#1
1
 /**
  * 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;
 }
 /**
  * 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}"]);
     }
 }
示例#3
0
 /**
  * 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
0
 /**
  * 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' => '*****@*****.**', 'password' => Hash::make('123')]);
     Member::create(['account' => 'derrick2', 'nick' => 'mikcy2', 'name' => '李四', 'mobile' => '11819887634', 'gender' => 1, 'age' => 32, 'email' => '*****@*****.**', 'password' => Hash::make('123')]);
     Member::create(['account' => 'derrick3', 'nick' => 'micky3', 'name' => '王五', 'mobile' => '13829887634', 'gender' => 1, 'age' => 26, 'email' => '*****@*****.**', 'password' => Hash::make('1223')]);
 }
示例#5
0
 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]);
 }
 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
0
 /**
  * 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
0
 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);
 }
 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));
     }
 }
	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.');
        }
	}
 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
0
 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('*****@*****.**', '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
0
 /**
  * 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
0
 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
0
 /**
  * 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'])]);
 }
示例#16
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\CreateMemberRequest $request)
 {
     Member::create($request->all());
     return redirect('members');
 }