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');
 }
 /**
  * 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'));
 }
 /**
  * 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'));
 }
Esempio n. 4
0
 /**
  * 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', 'Профиль обновлен!');
 }
 /**
  * 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'));
 }
 /**
  * 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');
 }
 /**
  * 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);
 }
 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);
 }
 /**
  * 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'));
 }
Esempio n. 10
0
 /**
  * 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);
 }
Esempio n. 11
0
 /**
  * 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');
 }
 /**
  * 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);
 }
 /**
  * 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>');
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $profile = Profile::findOrFail($id);
     return view('profiles.index', compact('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');
 }
Esempio n. 16
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $iid 	industry_id
  * @param  int  $id		profile_id
  * @return Response
  */
 public function destroy($iid, $id)
 {
     $industry = Industry::findOrFail($iid);
     $profile = Profile::findOrFail($id);
     $profile->delete();
     //dd($iid, $id);
     //return redirect('industries.profiles.index', compact('industry'));
     return view('profiles.index', compact('industry'));
 }
Esempio n. 17
0
 /**
  * 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 view('profile_locations.index', compact('profile'));
 }
 /**
  * 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();
     $profile->certificates()->detach($certificate);
     return view('profile_certificates.index', compact('profile'));
 }
Esempio n. 19
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $profile = Profile::findOrFail($id);
     $profile->delete();
     //return view('employees.index', compact('profile'));
     return redirect('/');
 }
Esempio n. 20
0
 /**
  * Create a new user with an automatillay generated username.
  * If an $account is provided, the username will try to match the account personal info.
  *
  * @param  Account $account
  *
  * @return User
  * @throws \Exception
  */
 public static function autoCreate(Account $account = null)
 {
     // Profile of the user
     $profile = Profile::findOrFail(config('site.auto-registration-profile'));
     // Seeds for the username
     $seeds = !$account ? [] : array_filter([$account->first_name, $account->last_name, $account->name, $account->nickname, preg_replace('/([^@]*).*/', '$1', $account->email), $account->first_name . str_random(4), $account->last_name . str_random(4), $account->name . str_random(4), $account->nickname . str_random(4), $account->provider->name . $account->uid]);
     // Attempt to create user
     $user = new User(['username' => generate_username($seeds), 'name' => $account ? $account->nameForHumans() : null, 'password' => $password = str_random(60), 'password_confirmation' => $password, 'profile_id' => $profile->id]);
     if (!$user->save()) {
         throw new \Exception(_('Unable to create user'));
     }
     return $user;
 }