本文整理汇总了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');
}
示例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'));
}
示例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'));
}
示例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', 'Профиль обновлен!');
}
示例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'));
}
示例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');
}
示例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);
}
示例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);
}
示例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'));
}
示例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);
}
示例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');
}
示例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);
}
示例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>');
}
示例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'));
}
示例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');
}