当前位置: 首页>>代码示例>>PHP>>正文


PHP Profile::findOrFail方法代码示例

本文整理汇总了PHP中app\Profile::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::findOrFail方法的具体用法?PHP Profile::findOrFail怎么用?PHP Profile::findOrFail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Profile的用法示例。


在下文中一共展示了Profile::findOrFail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 public function delete($id)
 {
     $profile = Profile::findOrFail($id);
     if (Gate::denies('manage-profile', $profile)) {
         return abort(403);
     }
     $profile->delete();
     $this->flasher->success('Profile Deleted', 'The profile has been deleted.');
     return redirect('admin');
 }
开发者ID:michaeljoyner,项目名称:expeditionists,代码行数:10,代码来源:ProfilesController.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @param  int  $id		profile id
  * @return \Illuminate\Http\Response
  */
 public function index($id)
 {
     $profile = Profile::findOrFail($id);
     $applications = collect();
     foreach ($profile->applications as $application) {
         //$jobpost_id = $markedjobpost->jobpost_id;
         $line = Jobpost::byjobpostid($application->jobpost_id)->get()->first();
         $applications->push($line);
     }
     return view('applications.index', compact('profile', 'applications'));
 }
开发者ID:Vladimir-Florian,项目名称:Pasu,代码行数:17,代码来源:ApplicationsController.php

示例3: index

 /**
  * Display a list of the marked jobposts for the profile id
  *
  * @param  int  $id		profile id
  * @return Response
  */
 public function index($id)
 {
     //$markedjobposts = Markedjobpost::where('profile_id', $id)->get();
     $profile = Profile::findOrFail($id);
     $markedposts = collect();
     foreach ($profile->markedjobposts as $markedjobpost) {
         //$jobpost_id = $markedjobpost->jobpost_id;
         $line = Jobpost::byjobpostid($markedjobpost->jobpost_id)->get()->first();
         $markedposts->push($line);
     }
     return view('markedjobposts.index', compact('profile', 'markedposts'));
 }
开发者ID:Vladimir-Florian,项目名称:Pasu,代码行数:18,代码来源:MarkedjobspostsController.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $profile = Profile::findOrFail($id);
     if ($request->hasFile('avatar')) {
         $avatar = 'ava-' . str_random(20) . '.' . $request->file('avatar')->getClientOriginalExtension();
         if (!file_exists('img/users/' . $profile->user->id)) {
             Storage::makeDirectory('img/users/' . $profile->user->id);
         }
         $file = Image::make($request->file('avatar'));
         $file->fit(250, null);
         $file->crop(250, 250);
         $file->save('img/users/' . $profile->user->id . '/' . $avatar, 50);
         if (!empty($profile->avatar)) {
             Storage::delete('img/users/' . $profile->user->id . '/' . $profile->avatar);
         }
     }
     // $profile->user->email = $request->email;
     $profile->user->name = $request->name;
     $profile->user->status = $request->status;
     $profile->user->save();
     $profile->sort_id = $request->sort_id;
     $profile->city_id = $request->city_id;
     if ($request->section_id != 0) {
         $profile->section_id = $request->section_id;
     }
     $profile->stars = $request->stars;
     $profile->phone = $request->phone;
     $profile->skills = $request->skills;
     $profile->address = $request->address;
     $profile->website = $request->website;
     if (isset($avatar)) {
         $profile->avatar = $avatar;
     }
     $profile->status = $request->status;
     $profile->save();
     return redirect()->route('admin.users.index')->with('status', 'Профиль обновлен!');
 }
开发者ID:vizovteam,项目名称:vizov,代码行数:43,代码来源:AdminUsersController.php

示例5: forjobtype

 /**
  * Lists the job posts of a job type .
  *
  * @param  int $id 	profile id
  * @param  int $tid 	job type id
  * @return Response
  */
 public function forjobtype($id, $tid)
 {
     //dd($id);
     $profile = Profile::findOrFail($id);
     $jobposts = Jobpost::byjobtype($tid)->get();
     $jobtype = Jobtype::findOrFail($tid);
     //return response()->json(compact('jobposts'));
     return view('candidate_jobposts.forjobtype', compact('profile', 'jobposts', 'jobtype'));
 }
开发者ID:Vladimir-Florian,项目名称:Pasu,代码行数:16,代码来源:CandidateJobPostsController.php

示例6: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $profile = Profile::findOrFail($id);
     if ($this->userNotOwnerOf($profile)) {
         throw new UnauthorizedException();
     }
     Profile::destroy($id);
     if (Auth::user()->isAdmin()) {
         alert()->overlay('Attention!', 'You deleted a profile', 'error');
         return Redirect::route('profile.index');
     }
     alert()->overlay('Attention!', 'You deleted a profile', 'error');
     return Redirect::route('home');
 }
开发者ID:anthony-brindley,项目名称:laraboot,代码行数:20,代码来源:ProfileController.php

示例7: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $iid		profile_id
  * @param  int  $id		certificate_id
  * @return Response
  */
 public function destroy($iid, $id)
 {
     $profile = Profile::findOrFail($iid);
     $certificate = $profile->certificates()->where('id', $id)->first();
     try {
         $profile->certificates()->detach($certificate);
     } catch (\Exception $e) {
         return response()->json(['Cannot Delete Certificate'], $e->getStatusCode());
     }
     return response()->json(['success profile' . $profile->id], 200);
 }
开发者ID:Vladimir-Florian,项目名称:Pasu,代码行数:18,代码来源:aProfile_certificatesController.php

示例8: postUnfeature

 public function postUnfeature($profile_id)
 {
     /** @var Profile $profile */
     $profile = Profile::findOrFail($profile_id);
     $profile->featured = false;
     $profile->save();
     return redirect()->to(\URL::previous() . '#profile-' . $profile->id);
 }
开发者ID:productionEA,项目名称:pockeyt-api,代码行数:8,代码来源:ProfilesController.php

示例9: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id 	profile_id
  * @return Response
  */
 public function destroy($id)
 {
     $profile = Profile::findOrFail($id);
     File::delete($profile->resume->file_path);
     $profile->resume()->delete();
     $profile = Profile::findOrFail($id);
     return view('profile_resume.index', compact('profile'));
 }
开发者ID:Vladimir-Florian,项目名称:Pasu,代码行数:14,代码来源:ResumesController.php

示例10: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id 	profile_id
  * @return Response
  */
 public function destroy($id)
 {
     $profile = Profile::findOrFail($id);
     File::delete($profile->resume->file_path);
     $profile->resume()->delete();
     $profile = Profile::findOrFail($id);
     return response()->json(['success profile' . $profile->id], 200);
 }
开发者ID:Vladimir-Florian,项目名称:Pasu,代码行数:14,代码来源:aResumesController.php

示例11: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     if (Gate::denies('admin')) {
         abort(403);
     }
     Profile::findOrFail($id)->delete();
     return redirect('/profile');
 }
开发者ID:diit,项目名称:e74-alpha,代码行数:14,代码来源:ProfileController.php

示例12: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $iid		profile_id
  * @param  int  $id			location_id
  * @return Response
  */
 public function destroy($iid, $id)
 {
     $profile = Profile::findOrFail($iid);
     $location = $profile->locations()->where('id', $id)->first();
     $profile->locations()->detach($location);
     $location->delete();
     return response()->json(['success profile' . $profile->id], 200);
 }
开发者ID:Vladimir-Florian,项目名称:Pasu,代码行数:15,代码来源:aProfile_locationsController.php

示例13: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, Profile::$rules_update);
     $user = User::findOrFail($id);
     if ($user->id != Auth::user()->id) {
         $user->detachAllRoles();
         $user->attachRole($request->input('role_id'));
         $user->status = $request->input('status');
     }
     $profile = Profile::findOrFail($user->profile->id);
     $profile->update($request->all());
     $enterprise = $user->enterprise;
     if ($request->input('password') != '') {
         $this->validate($request, ['password' => 'required|confirmed|min:6']);
         $user->password = bcrypt($request->input('password'));
         $user->save();
         Mail::send('emails.change_passwd_staff', ['data' => $request->all(), 'empresa' => $enterprise], function ($m) use($enterprise, $user, $profile) {
             $m->to($user->email, $profile->nombre . ' ' . $profile->apellido)->cc($enterprise->email, $enterprise->razon_social)->subject('Cambio de contraseña, usuario: ' . $user->name);
         });
     } else {
         $user->save();
     }
     return redirect()->route('admin.empresa.staff', $enterprise[0]->id)->with('message', '<div class="alert alert-success" style="margin-top:15px">Usuario actualizado con Éxito.</div>');
 }
开发者ID:nostick,项目名称:telesistemas,代码行数:31,代码来源:UserEnterpriseController.php

示例14: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $profile = Profile::findOrFail($id);
     return view('profiles.index', compact('profile'));
 }
开发者ID:jjmmarquez,项目名称:SCCAlumniPortal,代码行数:11,代码来源:ProfilesController.php

示例15: update_profile

 public function update_profile(EditProfileRequest $request, $id)
 {
     $profiles = Profile::findOrFail($id);
     $name = "";
     if ($request->file('curriculum')) {
         $file = $request->file('curriculum');
         $name = 'Appmm_' . time() . '.' . $file->getClientOriginalExtension();
         Storage::disk('profiles')->put($name, \File::get($file));
     }
     $profiles->fill($request->all());
     $profiles->curriculum = $name;
     $profiles->save();
     $id_user = Auth::user()->id;
     $users = User::findOrFail($id_user);
     $users->iduser_update = $id_user;
     $users->save();
     Session::flash('message', 'El usuario ' . $profiles->user->name . ' Actualizo su perfil exitosamente');
     return redirect()->route('home');
 }
开发者ID:luiscarlosmarca,项目名称:matixmedia,代码行数:19,代码来源:UserController.php


注:本文中的app\Profile::findOrFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。