當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。