Esempio n. 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;
 }
Esempio n. 2
0
 public function postEvaluate(Request $request)
 {
     $data = $request->all();
     $user_id = $data['user_id'];
     $evaluation = $data['evaluation'];
     $user = User::where("id", $user_id)->first();
     $event = $this->currentEvent();
     if ($evaluation == "false") {
         $user->delete();
     } else {
         $user->standing = "active";
         $user->save();
         $position = $data['position'];
         if ($position == "Overall Activity Head") {
             $event->oah_id = $user_id;
             $event->save();
         } elseif ($position == "Committee Head") {
             $comm_id = $data['comm_id'];
             $comm = Committee::where("event_id", $event->id)->where("id", $comm_id)->first();
             $head = new Head();
             $head->position = $comm->name . " Head";
             $head->user_id = $user_id;
             $head->comm_id = $comm->id;
             $head->event_id = $event->id;
             $head->save();
         } else {
             $member = new Member();
             $member->user_id = $user_id;
             $member->comm_id = $comm_id;
             $member->save();
         }
     }
     return redirect('/admin');
 }
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     if (!isset($data['type'])) {
         $data['type'] = 'none';
     } elseif ($data['type'] == 'member') {
         Validator::make($data, ['firstname' => 'required', 'lastname' => 'required']);
         //create user
         $user = User::create(['name' => $data['firstname'] . ' ' . $data['lastname'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'contact' => $data['contact'], 'type' => $data['type']]);
         $member = new Member();
         $member->user_id = $user->id;
         $member->firstname = $data['firstname'];
         $member->lastname = $data['lastname'];
         if ($member->save()) {
             session()->flash('success', 'Member Profile Created Successfully!');
         } else {
             $user->delete();
             session()->flash('error', 'Error! Please try again..');
         }
     } elseif ($data['type'] == 'artist') {
         Validator::make($data, ['firstname' => 'required', 'lastname' => 'required']);
         //create user
         $user = User::create(['name' => $data['firstname'] . ' ' . $data['lastname'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'contact' => $data['contact'], 'type' => $data['type']]);
         $artist = new Artist();
         $artist->user_id = $user->id;
         $artist->firstname = $data['firstname'];
         $artist->lastname = $data['lastname'];
         if ($artist->save()) {
             session()->flash('success', 'Artist Profile Created Successfully!');
         } else {
             $user->delete();
             session()->flash('error', 'Error! Please try again..');
         }
     } elseif ($data['type'] == 'studio') {
         Validator::make($data, ['name' => 'required', 'title' => 'required']);
         //create user
         $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'contact' => $data['contact'], 'type' => $data['type']]);
         $studio = new Studio();
         $studio->user_id = $user->id;
         $studio->name = $user->name;
         $studio->title = $data['title'];
         if ($studio->save()) {
             session()->flash('success', 'Studio Created Successfully!');
         } else {
             $user->delete();
             session()->flash('error', 'Error! Please try again..');
         }
     }
     //dd($data);
     //do your role stuffs here
     //send verification mail to user
     //--------------------------------------------------------------------------------------------------------------
     //$data['verification_code']  = $user->verification_code;
     Mail::send('emails.welcome', $data, function ($message) use($data) {
         $message->from('*****@*****.**', "Tattoo Cultr");
         $message->subject("Welcome to Tattoo Cultr");
         $message->to($data['email']);
     });
     return $user;
 }
Esempio n. 4
0
 /**
  * Update the specified resource in storage.
  *
  * @param Requests\UpdateMemberRequest|Request $request
  * @param Member $member
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\UpdateMemberRequest $request, Member $member)
 {
     $input = $request->all();
     if (isset($input['loot']) && $input['loot'] != '0') {
         $member->loot()->attach($input['loot'], ['awarded_at' => $input['awarded_at']]);
         unset($input['loot']);
     }
     $member->update($input);
     return redirect('members');
 }
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     $member = new Member();
     $member->fname = $data['firstname'];
     $member->lname = $data['lastname'];
     $member->email = $data['email'];
     $member->bday = $data['birthday'];
     $member->gender = $data['gender'];
     $member->mobile = $data['mobile'];
     $member->save();
     $inserted_id = $member->id;
     return User::create(['email' => $data['email'], 'password' => bcrypt($data['password']), 'indicator_id' => '5', 'login_id' => $inserted_id]);
 }
 /**
  * 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}"]);
     }
 }
Esempio n. 7
0
 public function index()
 {
     $officialDate = Carbon::now()->subDay();
     $birthdays = Member::whereMonth('birthday', '=', $officialDate->format('m'))->whereDay('birthday', '=', $officialDate->format('d'))->get();
     //dd($members);
     return view('welcome')->with('birthdays', $birthdays);
 }
 public function edit(Request $request)
 {
     $rules = array('fullname' => 'required', 'address' => 'required', 'zipcode_id' => 'required');
     $validator = \Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         return Response::json(array('result' => false, 'data' => 'ข้อมูลผิดพลาด', 'message' => $validator->messages()->all()));
     }
     $user = \Auth::user();
     if ($user == null) {
         return Response::json(array('result' => false, 'data' => 'can not define user.'));
     }
     $member = Member::where('id', $user->id)->first();
     //var_dump($member);
     $member->fullname = $request->input('fullname');
     $member->address = $request->input('address');
     $member->district_id = $request->input('district_id');
     $member->amphur_id = $request->input('amphur_id');
     $member->province_id = $request->input('province_id');
     $member->zipcode_id = $request->input('zipcode_id');
     if ($member->save()) {
         return Response::json(array('result' => true, 'data' => 'บันทึกข้อมูลเสร็จเรียบร้อย'));
     } else {
         return Response::json(array('result' => false, 'data' => 'เกิดข้อผิดพลาด'));
     }
 }
Esempio n. 9
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $users = Member::latest()->paginate(15);
     $membership_types = MembershipType::lists('type', 'id')->put('0', 'all')->sortBy('id');
     $institution_type = InstitutionType::lists('name', 'id');
     return view('backend.memberships.listing', compact('membership_types', 'users', 'institution_type', 'typeName'));
 }
Esempio n. 10
0
 /**
  * Obtain the user information from GitHub.
  *
  * @return Response
  */
 public function handleProviderCallback(Request $request)
 {
     // Used for development purposes. Hit /auth/google/callback
     // to get a dummy JWT for local use.
     if (\App::environment('local')) {
         $member = Member::findOrFail(1);
         if (!$member->hasRole('member')) {
             $member->attachRole(Role::where('name', 'member')->firstOrFail());
         }
         $token = JWTAuth::fromUser($member, ['level' => config('auth.levels.high'), 'member' => $member]);
         return response()->json($token);
     }
     $provider = new GoogleRitProvider($request);
     $user = $provider->user();
     if (array_get($user->user, 'domain', '') != 'g.rit.edu') {
         return new JsonResponse(['error' => 'domain user not authorized'], Response::HTTP_FORBIDDEN);
     }
     $member = Member::firstOrNew(['email' => $user->email]);
     $member->first_name = $user->user['name']['givenName'];
     $member->last_name = $user->user['name']['familyName'];
     $member->save();
     if (!$member->hasRole('member')) {
         $member->attachRole(Role::where('name', 'member')->firstOrFail());
     }
     $token = JWTAuth::fromUser($member, ['level' => config('auth.levels.high'), 'member' => $member]);
     if ($callback = $provider->getCallback()) {
         return redirect($callback . '?token=' . $token);
     } else {
         return response()->json(['token' => $token]);
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $member = Member::find($id);
     $member->delete();
     return \Redirect::to('admin.member.index');
 }
Esempio n. 12
0
 public function showMember(Request $r)
 {
     $member = Member::where("id", $r->input('id'))->get();
     $hc = new HomeController();
     $vars = $hc->getVars();
     return view('member', ['member' => $member[0], "lang" => "fa", "vars" => $vars]);
 }
 public function update(Request $request, $id)
 {
     $member = \App\Member::findOrFail($id);
     $member->name = $request->name;
     $member->save();
     return redirect('/');
 }
 /**
  * Run the database seeds.
  */
 public function run()
 {
     Model::unguard();
     Member::truncate();
     $this->call('MemberTableSeeder');
     Model::reguard();
 }
Esempio n. 15
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());
 }
Esempio n. 16
0
 /**
  * Handle a registration request for the application.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postRegister(Request $request)
 {
     $validator = $this->registrar->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $this->auth->login($this->registrar->create($request->all()));
     $member = new Member();
     $member->first_name = $request->first_name;
     $member->last_name = $request->last_name;
     $member->save();
     $mail = new Mail();
     $mail->mail = $request->email;
     $mail->code = rand(1000000, 9999999);
     $mail->save();
     return redirect($this->redirectPath());
 }
Esempio n. 17
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($memberId, $pointId)
 {
     $point = Point::find($pointId);
     $member = Member::find($memberId);
     $member->update(['total_points' => $member->total_points - $point->point]);
     $point->Delete('set null');
     return redirect()->action('MembersController@show', $memberId);
 }
Esempio n. 18
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')]);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $rules = ["name" => "required|min:3", "email" => "required|email", "blog" => "url", "github" => "", "twitter" => "", "group" => "exists:groups,id", "g-recaptcha-response" => "required|captcha"];
     $validator = Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         return Redirect::route("community.create")->withErrors($validator)->withInput();
     }
     $member = new Member();
     $member->name = $request->input("name");
     $member->email = $request->input("email");
     $member->blog = $request->input("blog");
     $member->github = $request->input("github");
     $member->twitter = $request->input("twitter");
     $member->group_id = $request->input("group");
     $member->save();
     return Redirect::route("community.index")->with("success", "Başarıyla topluluğa katıldınız!");
 }
Esempio n. 20
0
 public static function getCategory($slug)
 {
     // get category members
     $r = Member::getCategoryMembers($slug);
     printR($r);
     exit;
     // get member social media
 }
Esempio n. 21
0
 private function numMembers()
 {
     $numActive = Member::all()->where('is_active', 1)->count();
     $numInactive = Member::all()->where('is_active', 0)->count();
     $numDischarged = Member::onlyTrashed()->count();
     $numTotal = Member::withTrashed()->count();
     return ['numActive' => $numActive, 'numInactive' => $numInactive, 'numDischarged' => $numDischarged, 'numTotal' => $numTotal];
 }
Esempio n. 22
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $appli = MemApplicant::findOrFail($request::get('id'));
     $appli->accepted = $request::get('accept');
     //dd($appli->accepted);
     $appli->save();
     if ($appli->accepted == 'true') {
         $mem = new Member();
         $mem->lName = $appli->lName;
         $mem->fName = $appli->fName;
         $mem->mName = $appli->mName;
         $mem->gender = $appli->gender;
         $mem->memDate = Carbon::now();
         $mem->addr = $appli->addr;
         $mem->bDay = $appli->bDay;
         $mem->religion = $appli->religion;
         $mem->civilStatus = $appli->civilStatus;
         $mem->spouse = $appli->spouse;
         $mem->highestEd = $appli->highestEd;
         $mem->occupation = $appli->occupation;
         $mem->beneficiary = $appli->beneficiary;
         $mem->relToMem = $appli->relToMem;
         $mem->contact = $appli->contact;
         $mem->initShare = $appli->initShare;
         $mem->amntShare = $appli->amntShare;
         $mem->initCBU = $appli->initCBU;
         $mem->landArea = $appli->landArea;
         $mem->credLine = $appli->credLine;
         $mem->municipality = $appli->municipality;
         $mem->barangay = $appli->barangay;
         $mem->ownType = $appli->ownType;
         //$mem->termination= $appli->termination;
         $mem->status = $request::get('status');
         $mem->save();
         $us = new User();
         $us->email = $appli->email;
         $us->member_id = $mem->id;
         $us->password = bcrypt('regular');
         //to randomize
         $us->save();
     }
     $appli->delete();
     flash()->success("Success!");
     return redirect('/admin');
 }
Esempio n. 23
0
 public static function getMembersForMultiselect()
 {
     $members = Member::all(array('id', 'name'))->toArray();
     $multiselectMembers = array();
     foreach ($members as $member) {
         $multiselectMembers[$member['id']] = $member['name'];
     }
     return $multiselectMembers;
 }
Esempio n. 24
0
 public function byId($id)
 {
     try {
         $this->member = Member::findOrFail($id);
         return true;
     } catch (ModelNotFoundException $e) {
         return false;
     }
 }
Esempio n. 25
0
 public function projectList()
 {
     $projects_member_id = Member::where("Developer_id", auth()->User()->id)->get()->pluck("project_id");
     $project_owner_id = Project::where("developer_id", auth()->User()->id)->get()->pluck("id");
     $projects_id = array_merge($projects_member_id->toArray(), $project_owner_id->toArray());
     $project = Project::whereIn("id", $projects_id)->get();
     $developer = DB::table('Developer')->get();
     return view("project.list")->with('project', $project)->with('developer', $developer);
 }
Esempio n. 26
0
 public function export()
 {
     $data = Member::all();
     Excel::create('Filename', function ($excel) use($data) {
         $excel->sheet('Sheetname', function ($sheet) use($data) {
             $sheet->fromArray($data);
         });
     })->download('xls');
 }
Esempio n. 27
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]);
 }
Esempio n. 28
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($id)
 {
     if ($id != null || intval($id) > 0) {
         $user = Member::find(intval($id));
         $payment = Payment::filterByServiceAndMember(1, $user->id)->first();
         //membership
         $journal = Journal::where('payment_id', $payment->id);
         return view('backend.memberships.payment', compact('user', 'payment', 'journal'));
     }
 }
 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);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $data = Employee::all();
     $name = Auth::user()->name;
     $pos = ProjectOfficer::all();
     $adms = Admin::all();
     $tls = Teamleader::all();
     $mems = Member::all();
     return view('dropmin.dashboard.index')->with('data', $name)->with('pos', $pos)->with('adms', $adms)->with('tls', $tls)->with('mems', $mems)->with('data', $data);
 }