本文整理汇总了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');
}
示例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);
}
示例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'));
}
}
示例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);
}
示例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();
}
}
示例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'));
}
示例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";
}
示例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;
}
}
示例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);
}
示例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]);
}
示例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;
}
示例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);
}
示例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');
}
示例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('/');
}
示例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);
}
}