當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Member::find方法代碼示例

本文整理匯總了PHP中app\Member::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP Member::find方法的具體用法?PHP Member::find怎麽用?PHP Member::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Member的用法示例。


在下文中一共展示了Member::find方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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');
 }
開發者ID:xubodreamsky,項目名稱:cn.arcoss.free,代碼行數:13,代碼來源:MemberController.php

示例2: destroy

 /**
  * 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);
 }
開發者ID:jacqhernandez,項目名稱:lsopcs,代碼行數:14,代碼來源:PointsController.php

示例3: index

 /**
  * 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'));
     }
 }
開發者ID:harshiarora,項目名稱:csi-1,代碼行數:15,代碼來源:PaymentController.php

示例4: update

 public function update(Request $request, $id)
 {
     $member = Member::find($id);
     $medicalrecord = MedicalRecord::firstOrCreate(['member_id' => $member->id]);
     $medicalrecord->fill($request->all());
     $medicalrecord->member()->associate($member);
     $medicalrecord->save();
     Flash::success("<b>¡Se ha actualizado la ficha medica de " . $member->first_name . " de manera exitosa!</b>");
     return redirect()->route('admin.member.show', $member->id);
 }
開發者ID:StivenSerna,項目名稱:gym,代碼行數:10,代碼來源:MedicalRecordsController.php

示例5: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     if (urlRequest::has('setstatus')) {
         $setStatus = (int) urlRequest::get('setstatus');
         $member = Member::find($id);
         $member->status = $setStatus;
         $member->save();
         return redirect()->back();
     }
 }
開發者ID:jallowmamadou,項目名稱:balance-1,代碼行數:16,代碼來源:MembersshipsController.php

示例6: verify

 public function verify($id, \Illuminate\Http\Request $request)
 {
     $user_status = "inactive";
     $key = explode('-', $id);
     $member = Member::find($key[0]);
     if ($member->hash_key == $key[1]) {
         $member->status = 1;
         $member->save();
         $user_status = "active";
     }
     return view('emails.verify', compact('user_status'));
 }
開發者ID:KunwarSingh,項目名稱:Book-My-Party-Venue,代碼行數:12,代碼來源:MainController.php

示例7: index

 public function index()
 {
     foreach (Member::all() as $item) {
         sleep(2);
         // ip-api.com ban any IP addresses doing over 150 requests per minute
         $json = json_decode(file_get_contents("http://ip-api.com/json/{$item->ip}"));
         $item->city = $json->city;
         $item->country = $json->country;
         $member = Member::find($item->id);
         $member->city = $item->city;
         $member->country = $item->country;
         $member->save();
     }
     return "Ready";
 }
開發者ID:h2jose,項目名稱:GetCountryByIP,代碼行數:15,代碼來源:MemberController.php

示例8: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     //This id is passed by the controller that calls the request class
     $member = Member::find($this->id);
     switch ($this->method()) {
         case 'GET':
         case 'DELETE':
             return [];
         case 'POST':
             return ['name' => 'required|unique:members,name', 'position' => 'required', 'order' => 'numeric', 'image' => 'required|image|mimes:jpeg,bmp,png|max:1500'];
         case 'PUT':
         case 'PATCH':
             return ['name' => 'required|unique:members,name,' . $member->id, 'position' => 'required', 'order' => 'numeric', 'image' => 'image|mimes:jpeg,bmp,png|max:1500'];
         default:
             break;
     }
 }
開發者ID:victorfdt,項目名稱:theliteracycenter,代碼行數:22,代碼來源:MemberRequest.php

示例9: create

 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create($member_id)
 {
     $memberships = Membership::all()->lists('description', 'id');
     $membershipsAll = Membership::all();
     $member = Member::find($member_id);
     $rangeArray = array();
     $rangeDates = \App\Affiliation::orderBy('finalization', 'DEC')->where('member_id', $member_id)->where('finalization', '>=', Carbon::now())->get();
     foreach ($rangeDates as $range) {
         $initiationRange = new Carbon($range->initiation);
         $finalizationRange = new Carbon($range->finalization);
         $diference = $initiationRange->diffInDays($finalizationRange);
         for ($i = 0; $i <= $diference; $i++) {
             array_unshift($rangeArray, "'" . $initiationRange->copy()->format('Y-m-d') . "'");
             $initiationRange->addDay();
         }
     }
     return view('affiliation.create')->with('memberships', $memberships)->with('membershipsAll', $membershipsAll)->with('member', $member)->with('affiliationRange', $rangeArray);
 }
開發者ID:StivenSerna,項目名稱:gym,代碼行數:23,代碼來源:AffiliationsController.php

示例10: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $member = Member::find($id);
     $user = Auth::user();
     $isMemberProfile = false;
     $isFollowing = false;
     if (Auth::check()) {
         if ($member->user_id == Auth::User()->id) {
             $isMemberProfile = true;
         }
         if (Follow::where('artist_id', $member->id)->where('user_id', $user->id)->count()) {
             $isFollowing = true;
         }
     }
     //if not an image url from facebook
     if (filter_var($member->user->avatar, FILTER_VALIDATE_URL) === FALSE) {
         $member->user->avatar = url('uploads/images/thumbnail/' . $member->user->avatar);
     }
     return view('pages.artist', ['artist' => $member, 'isArtistProfile' => $isMemberProfile, 'isFollowing' => $isFollowing]);
 }
開發者ID:erabhidhaliwal,項目名稱:oottatcultr,代碼行數:26,代碼來源:MemberController.php

示例11: loadResources

 public function loadResources()
 {
     $resources = DB::table('events_resources')->where('event_id', $this->id)->get();
     foreach ($resources as $resource) {
         if ($resource->member_id >= 1) {
             if ($member = Member::find($resource->member_id)) {
                 $resource->member = $member->first_name . " " . $member->last_name;
             } else {
                 $resource->member = "Desconocido";
             }
         } else {
             $resource->member = "Ninguno";
         }
         $joinResource = Resource::find($resource->resource_id);
         if ($joinResource) {
             $resource->type = $joinResource->type;
         } else {
             $resource->type = "Desconocido";
         }
     }
     $this->resources = $resources;
 }
開發者ID:pedronalbert,項目名稱:lions-server,代碼行數:22,代碼來源:Event.php

示例12: store

 public function store(Request $request)
 {
     $anthropometricm = new AnthropometricMeasurement($request->all());
     $leftanthropometric = new LeftAnthropometric($request->all());
     $rightanthropometric = new RightAnthropometric($request->all());
     if ($anthropometricm->height == 0) {
         $imc = 0;
     } else {
         $imc = $anthropometricm->weight / ($anthropometricm->height / 100 * ($anthropometricm->height / 100));
     }
     $anthropometricm->imc = $imc;
     //$anthropometricm->save();
     $member = Member::find($request->member_id);
     $leftanthropometric->save();
     $rightanthropometric->save();
     $anthropometricm->leftAnthropometric()->associate($leftanthropometric);
     $anthropometricm->rightAnthropometric()->associate($rightanthropometric);
     $anthropometricm->member()->associate($member);
     $anthropometricm->save();
     Flash::success("¡ Se ha registrado la ficha antropometrica de " . $member->first_name . " exitosamente !");
     return redirect()->route('admin.member.show', $member->id);
 }
開發者ID:StivenSerna,項目名稱:gym,代碼行數:22,代碼來源:AnthropometricsRecordsController.php

示例13: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, MemberRequest $request)
 {
     $member = Member::find($id);
     $oldOrder = $member->order;
     $newOrder = $request->input('order');
     $type = $request->input('type');
     /* 
     Laravel can not handle using the request manager the validation
     of the size image that exceeds the configuration of php.in
     */
     if ($this->imageHelper->fileImageSizeExceeded($request->file('image'))) {
         //Set the message and the error class
         Session::flash('message', 'The file image can not be greater than 2MB!');
         Session::flash('alert-class', 'alert-danger');
         return redirect()->back();
     }
     //Fill this member with the new form information
     $member->fill($request->all());
     //Getting the max permitted position
     $maxPosition = Member::where('type', $type)->count();
     //If the admin informed a greater position, set the position as the maximum one
     if ($member->order > $maxPosition) {
         $member->order = $maxPosition;
         $newOrder = $maxPosition;
     }
     //Setting the right order
     $this->imageHelper->adjustUpdateOrder($type, $oldOrder, $newOrder, $member);
     //Checking if there was uploaded a image
     if ($request->file('image') != null) {
         //Delete the old member image from the filesystem
         File::delete($member->path);
         //Moves and sets the new uploaded image
         $this->imageHelper->uploadImage($request, $member);
     }
     $member->save();
     //Sending the user to the accounts page
     return redirect()->route('member/index');
 }
開發者ID:victorfdt,項目名稱:theliteracycenter,代碼行數:44,代碼來源:MembersController.php

示例14: uploadTattoo

 /**
  * Upload Tattoo
  *
  * @return View
  */
 public function uploadTattoo(Request $request)
 {
     $user = Auth::user();
     if ($request->hasFile('tattoo')) {
         //upload an image to the /img/tmp directory and return the filepath.
         //dd($request);
         $file = $request->file('tattoo');
         $tmpFilePath = '/uploads/images/original/';
         $tmpFileName = 'tattoo-' . time() . '-' . $file->getClientOriginalName();
         //save original file
         $file = $file->move(public_path() . $tmpFilePath, $tmpFileName);
         $path = $tmpFilePath . $tmpFileName;
         //edit image
         $img = \Image::make($file);
         // $img->backup();
         // reset image (return to backup state)
         // $img->reset();
         $img->fit(360);
         //240*240
         $img->save('uploads/images/thumbnail/' . $tmpFileName);
         // reset image (return to backup state)
         // $img->reset();
         $img->fit(120);
         //100*100
         $img->save('uploads/images/small/' . $tmpFileName, 40);
         $img->destroy();
         //save tattoo in DB
         $tattoo = new Tattoo();
         $tattoo->title = $request->input('title');
         $tattoo->url = $tmpFileName;
         $tattoo->description = $request->input('description');
         $tattoo->user_id = $user->id;
         $tattoo->approved = false;
         if ($request->input('type') == 'member') {
             $member = Member::find($request->input('id'));
             if ($user->id == $member->user->id) {
                 $tattoo->approved = false;
                 //member - self tattoos ll never be approved for public place, only visible to member page(always, no approval needed)
                 $tattoo->save();
             }
             return redirect('profile')->with('success', "Successfully uploaded!");
         } elseif ($request->input('type') == 'artist') {
             $artist = Artist::find($request->input('id'));
             //if uploaded by self
             if ($artist->user->id == $user->id) {
                 $tattoo->approved = true;
             }
             $artist->tattoos()->save($tattoo);
             return redirect('artist/' . $artist->user->slug)->with('success', "Successfully uploaded!");
         } elseif ($request->input('type') == 'studio') {
             $studio = Studio::find($request->input('id'));
             //if uploaded by self
             if ($studio->user->id == $user->id) {
                 $tattoo->approved = true;
             }
             $studio->tattoos()->save($tattoo);
             return redirect('studio/' . $studio->user->slug)->with('success', "Successfully uploaded!");
         } else {
             session()->flash('error', "Error in uploading tattoo!! Please try again..");
         }
     } else {
         session()->flash('error', "Please select a file!!");
     }
     return redirect('/');
 }
開發者ID:axovel,項目名稱:tattoo,代碼行數:70,代碼來源:TattooController.php

示例15: addMember

 public function addMember(Request $request, $eventId)
 {
     if (!Auth::check()) {
         return response()->json($this->notLoginJson, 401);
     } else {
         $user = Auth::user();
         if (!$user->hasRole('admin')) {
             return response()->json($this->needPermissionsJson, 401);
         }
     }
     $memberId = $request->input('member_id');
     $event = Event::find($eventId);
     if ($event) {
         $member = $event->members()->where('member_id', $memberId)->count();
         if ($member > 0) {
             return response()->json(['message' => 'Miembro ya registrado'], 400);
         } else {
             $event->members()->attach($memberId);
             $member = Member::find($memberId);
             return response()->json($member);
         }
     } else {
         return response()->json($this->eventNotFoundJson, 404);
     }
 }
開發者ID:pedronalbert,項目名稱:lions-server,代碼行數:25,代碼來源:EventController.php


注:本文中的app\Member::find方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。