本文整理汇总了PHP中app\Member类的典型用法代码示例。如果您正苦于以下问题:PHP Member类的具体用法?PHP Member怎么用?PHP Member使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Member类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postEvaluate
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');
}
示例2: create
/**
* 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('no-reply@tattoocultr.com', "Tattoo Cultr");
$message->subject("Welcome to Tattoo Cultr");
$message->to($data['email']);
});
return $user;
}
示例3: update
/**
* 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');
}
示例4: create
/**
* 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]);
}
示例5: 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;
}
示例6: 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}"]);
}
}
示例7: index
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);
}
示例8: edit
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' => 'เกิดข้อผิดพลาด'));
}
}
示例9: index
/**
* 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'));
}
示例10: handleProviderCallback
/**
* 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]);
}
}
示例11: destroy
/**
* 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');
}
示例12: showMember
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]);
}
示例13: update
public function update(Request $request, $id)
{
$member = \App\Member::findOrFail($id);
$member->name = $request->name;
$member->save();
return redirect('/');
}
示例14: run
/**
* Run the database seeds.
*/
public function run()
{
Model::unguard();
Member::truncate();
$this->call('MemberTableSeeder');
Model::reguard();
}
示例15: 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());
}