本文整理汇总了PHP中app\Member::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::save方法的具体用法?PHP Member::save怎么用?PHP Member::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Member
的用法示例。
在下文中一共展示了Member::save方法的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: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$image = $request->file("logo");
$member = new Member();
$member->fill($request->except('logo'));
$member->logo = self::upload_pic($image);
$member->save();
return redirect()->route('members.links', $member->id);
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @Response(201)
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$this->validate($request, ['first_name' => 'required', 'last_name' => 'required', 'email' => 'required|unique:members,email|regex:/[a-zA-Z]{2,3}\\d{4}/']);
$member = new Member();
$member->first_name = $request->input('first_name');
$member->last_name = $request->input('last_name');
$member->email = $request->input('email');
$member->save();
return new JsonResponse($member, Response::HTTP_CREATED);
}
示例5: store
public function store(Request $request)
{
$this->validate($request, ['mm_full_name' => 'required|max:225', 'mm_nick_name' => 'required|max:225', 'mm_nohp' => 'required|max:15', 'mm_notelp' => 'required|max:15', 'mm_address' => 'required', 'mm_hoby' => 'required']);
$member = new Member();
$member->mm_full_name = $request->mm_full_name;
$member->mm_nick_name = $request->mm_nick_name;
$member->mm_nohp = $request->mm_nohp;
$member->mm_notelp = $request->mm_notelp;
$member->mm_address = $request->mm_address;
$member->mm_hoby = $request->mm_hoby;
$member->save();
return redirect('members');
}
示例6: 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]);
}
示例7: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$Member = new Member();
$Member->name = $request->get('name');
$Member->email = $request->get('email');
$Member->phone = $request->get('phone');
$Member->country = $request->get('country');
$Member->uid = $request->user()->id;
$Member->save();
$members = Member::all();
$request->session()->flash('flash_message', "Member added succesfully");
return redirect()->back();
}
示例8: postEquipe
public function postEquipe(Request $request)
{
$this->validate($request, ['name' => 'required', 'email' => 'required', 'photo' => 'required', 'gender' => 'required', 'cargo-new' => 'required', 'area-new' => 'required']);
$membro = new Member();
$membro->name = Input::get('name');
$membro->email = Input::get('email');
$membro->photo = Input::get('photo');
$membro->gender = Input::get('gender');
$membro->cargo = Input::get('cargo-new');
$membro->diretoria = Input::get('area-new');
$membro->save();
$equipe = Member::all()->sortBy("name");
return redirect('/editar_equipe')->with('equipe', $equipe);
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
$validator = Validator::make($request->all(), ['hasKeys' => array('regex:/^(1|0|true|false)$/i'), 'name' => array('regex:/^[\\d\\w\\.][\\d\\w\\s\\.]*[\\d\\w\\.]$/'), 'active' => array('regex:/^(1|0|true|false)$/')]);
if ($validator->fails()) {
return response()->json(["error" => "validator failed", "cause" => $validator->failed()], 400);
} else {
$member = new Member();
$member->hasKeys = $request->hasKeys;
$member->name = $request->name;
$member->active = $request->active;
$member->save();
return response()->json($member, 201);
}
}
示例10: store
/**
* 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!");
}
示例11: postRegister
/**
* 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());
}
示例12: store
/**
* 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');
}
示例13: store
public function store(MemberRequest $request)
{
$input = $request->all();
$member = new Member();
$member->name = $input['name'];
$member->email = $input['email'];
$member->phone = $input['phone'];
if ($request->file()) {
$image = $request->file('image');
$filename = $request->file('image')->getClientOriginalName();
$path = public_path('img/' . $filename);
$size = '200,200';
Image::make($image->getRealPath())->resize(intval($size), null, function ($contstraint) {
$contstraint->aspectRatio();
})->save($path);
$member->image = 'img/' . $filename;
}
$member->save();
return redirect('member');
}
示例14: store
public function store(MemberCreateRequest $request)
{
if ($request->file('photo')) {
$file = $request->file('photo');
$name = 'fotogym_' . time() . '.' . $file->getClientOriginalExtension();
$path = public_path() . '/images/members/';
$file->move($path, $name);
}
$member = new Member($request->all());
$member->save();
$image = new Image();
if (isset($name)) {
$image->name = $name;
} else {
$image->name = 'fotogym_placeholder.png';
}
$image->member()->associate($member);
$image->save();
Flash::success("¡Se ha registrado a " . $member->first_name . " de manera exitosa!");
return redirect()->route('medicalrecord.create', $image->member_id);
}
示例15: completeProfileMember
/**
* Display the complete profile form
*
* @return View
*/
public function completeProfileMember()
{
$user = Auth::user();
if ($user->type == "none") {
$member = new Member();
$member->user_id = $user->id;
$member->firstname = $user->name;
$member->lastname = '';
if ($member->save()) {
$user->type = 'member';
$user->save();
session()->flash('success', 'Member Profile Created Successfully!');
}
}
if ($user->type == 'artist') {
return redirect('complete-profile-artist');
}
if (!$user->social) {
$user->avatar = url('uploads/images/small/' . $user->avatar);
}
return view('pages.completeProfileMember', ['user' => $user]);
}