public function tambahkandidat(Request $request) { $input = new Candidate(); $input->username = $request->input('username'); $input->password = Hash::make('himitjaya'); $input->hak_akses = 3; $input->nrp_caka = $request->input('nrp_caka'); $input->nrp_cawaka = $request->input('nrp_cawaka'); $input->status_upload = 0; $input->save(); return redirect()->action('AdminController@dashboard'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * * @return \Illuminate\Http\Response */ public function store(Request $request) { $this->validate($request, ['consent' => 'accepted', 'text' => 'required|max:250|min:10']); Candidate::create(['user_id' => Auth::user()->id, 'about' => $request->get('text'), 'term_id' => nextTerm()->id]); Session::flash('message', 'You successfully marked yourself as running.'); return redirect('/'); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('candidates')->delete(); $candidates = [['first_name' => 'MD. ABDULLAH-AL-FARUQUE RATUL', 'middle_name' => '', 'last_name' => 'YES 07', 'email' => '*****@*****.**', 'candidate_id' => '1', 'image_res' => 'abdullah.jpg'], ['first_name' => 'GULSHAN JUBAED PRINCE', 'middle_name' => '', 'last_name' => 'YES 08', 'email' => '*****@*****.**', 'candidate_id' => '2', 'image_res' => 'gulshan.jpg'], ['first_name' => 'MOBASHIR MONIM', 'middle_name' => '', 'last_name' => 'YES 10', 'email' => '*****@*****.**', 'candidate_id' => '3', 'image_res' => 'mobashir.jpg'], ['first_name' => 'MARYAN KARMOKER', 'middle_name' => '', 'last_name' => 'YES 10', 'email' => '*****@*****.**', 'candidate_id' => '4', 'image_res' => 'maryan.jpg'], ['first_name' => 'TAHSEEN LUBABA', 'middle_name' => '', 'last_name' => 'YES 11', 'email' => '*****@*****.**', 'candidate_id' => '5', 'image_res' => 'tahseen.jpg'], ['first_name' => 'MAESHA ISLAM SHUDHA', 'middle_name' => '', 'last_name' => 'YES 11', 'email' => '*****@*****.**', 'candidate_id' => '6', 'image_res' => 'maesha.jpg'], ['first_name' => 'TASNEEM KIBRIA ORPA', 'middle_name' => '', 'last_name' => 'YES 11', 'email' => '*****@*****.**', 'candidate_id' => '7', 'image_res' => 'tasneem.jpg'], ['first_name' => 'RADEEYAH ZAMAN KHAN', 'middle_name' => '', 'last_name' => 'YES 11', 'email' => '*****@*****.**', 'candidate_id' => '8', 'image_res' => 'raadeeyah.jpg'], ['first_name' => 'SUMAIYA KHAN DISHA', 'middle_name' => '', 'last_name' => 'YES 12', 'email' => '*****@*****.**', 'candidate_id' => '9', 'image_res' => 'sumaiya.jpg'], ['first_name' => 'IFREET TAHEEA', 'middle_name' => '', 'last_name' => 'YES 12', 'email' => '*****@*****.**', 'candidate_id' => '10', 'image_res' => 'ifreet.jpg']]; foreach ($candidates as $candidate) { Candidate::create($candidate); } }
public function save() { $data = Request::input('data'); Candidate::find($data['id'])->update(['status_record_id' => $data['status_record_id'], 'time_interview' => $data['time_interview'], 'time' => $data['time']]); if ($data['employee_id'] != '') { Candidate::find($data['id'])->employees()->sync($data['employee_id']); } if ($data['status_record_id'] == 2) { $candidate = Candidate::find($data['id']); Employee::create(['firstname' => $candidate->first_name, 'lastname' => $candidate->last_name, 'phone' => $candidate->phone, 'email' => $candidate->email, 'position_id' => $data['position'], 'date_of_birth' => $candidate->date_of_birth]); } }
public function upload(Request $request) { $file = Input::file('data'); $filename = $file->getClientOriginalName(); $destinationPath = 'berkas_kandidat/'; $file->move($destinationPath, $filename); $id = $request->session()->get('kandidat'); $update = Candidate::find($id); $update->status_upload = 1; $update->save(); return redirect()->action('CandidateController@dashboard'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * * @return \Illuminate\Http\Response */ public function store(Request $request) { $this->validate($request, ['vote' => 'required|array|vote_count|vote_unique|sane_votes']); $user = $request->user(); if ($user->uuid === null) { $user->update(['uuid' => uuid()]); } foreach ($request->get('vote') as $vote) { Vote::create(['candidate_id' => Candidate::findOrFail($vote)->id, 'user_id' => $user->id, 'term_id' => nextTerm()->id]); } Session::flash('message', 'Your votes were successfully counted.'); return redirect('/'); }
public function postlogin(Request $request) { $username = $request->input('username'); $password = $request->input('password'); $data_login = Candidate::where('username', $username)->first(); if ($data_login->count() > 0) { if (Hash::check($password, $data_login->password)) { $request->session()->put('kandidat', $data_login->id); return redirect()->action('CandidateController@index'); } else { return redirect()->action('LoginCandidateController@getlogin'); } } else { return redirect()->action('LoginCandidateController@getlogin'); } }
/** * Bootstrap any application services. * * @return void */ public function boot() { Validator::extend('vote_count', function ($attribute, $value, $parameters, $validator) { return count($value) <= env('NUM_ADMINS') && count($value) > 0; }); Validator::extend('vote_unique', function ($attribute, $value, $parameters, $validator) { return Auth::user()->canVote(); }); Validator::extend('sane_votes', function ($attribute, $value, $parameters, $validator) { $can = []; foreach ($value as $candidate) { if (Candidate::findOrFail($candidate)->term_id !== nextTerm()->id || in_array($candidate, $can)) { return false; } $can[] = $candidate; } return true; }); }
/** * Delete candidate * * @param int $id * @return Response */ public function destroy($id) { $candidate = Candidate::find($id); $files = File::where('candidate_id', '=', $candidate->id)->delete(); $candidate->delete(); return redirect()->route('candidates.index')->with('messageDelete', 'Delete candidate successfully!'); }
public function destroy($id) { $candidate = Candidate::find($id); $candidate->delete(); return Redirect::to('/dashboard/candidate')->with('message', 'Candidate deleted Successfully.'); }
$interviewsForJson[$interview->id] = ['id' => $interview->id, 'begins_at' => date_format($interview->slot->begins_at, 'H:i'), 'ends_at' => date_format($interview->slot->ends_at, 'H:i'), 'recruiter' => ['identity' => $interview->recruiter->identity, 'title' => $interview->recruiter->title]]; } return view('home', ['slots' => $slots, 'recruiters_rh' => Recruiter::with(['interviews.candidate'])->where('rh', true)->get(), 'recruiters_admissions' => Recruiter::with(['interviews.candidate'])->where('admissions', true)->get(), 'recruiters_coaching' => Recruiter::with(['interviews.candidate'])->where('coaching', true)->get(), 'interviews' => json_encode($interviewsForJson)]); }); Route::get('/gestion', ['middleware' => 'auth.basic', function () { return view('gestion', ['slots' => \App\Slot::all(), 'recruiters' => Recruiter::with(['interviews.candidate'])->get()]); }]); Route::get('/print', ['middleware' => 'auth.basic', function () { $pdfMaker = app('dompdf.wrapper'); $pdf = $pdfMaker->loadView('print', ['slots' => \App\Slot::all(), 'recruiters' => Recruiter::with(['interviews.candidate', 'interviews.slot'])->get()]); return $pdf->stream('entretiens_par_recruteurs.pdf'); }]); Route::post('/save-interview', function (SaveInterviewRequest $request) { return DB::transaction(function () use($request) { try { $candidate = Candidate::create(['firstname' => $request->input('firstname'), 'lastname' => $request->input('lastname'), 'email' => $request->input('email'), 'phone' => $request->input('phone'), 'promo' => $request->input('promo')]); $interview = Interview::findOrFail((int) $request->input('interview')); if (!is_null($interview->candidate_id)) { throw new Exception("Interview already taken!"); } $interview->candidate_id = $candidate->id; $interview->save(); return response()->json('Interview saved'); } catch (Exception $e) { return response()->json('Interview NOT saved', 500); } }); }); Route::post('/delete-interview', ['middleware' => 'auth.basic', function (DeleteInterviewRequest $request) { $interviewToDelete = Interview::with(['candidate', 'recruiter', 'slot'])->whereId($request->input('interview'))->firstOrFail(); $interviewToDelete->candidate_id = null;
public function countVote() { $candidates = Candidate::all(); $labels = array(); $viewDataset = array(); foreach ($candidates as $candidate) { array_push($labels, $candidate->first_name . " " . $candidate->last_name . " (" . $candidate->getVoteCount() . ") "); array_push($viewDataset, $candidate->getVoteCount()); } $viewData = array('labels' => $labels, 'datasets' => array(array('label' => "# of votes", 'fillColor' => "rgba(255, 206, 86, 0.2)", 'strokeColor' => "rgba(255, 206, 86, 0.2)", 'highlightFill' => "rgba(255, 206, 86, 0.2)", 'highlightStroke' => "rgba(220,220,220,1)", 'backgroundColor' => "rgba(75, 192, 192, 0.2)", 'borderColor' => "rgba(75, 192, 192, 1)", 'borderWidth' => "1", 'data' => $viewDataset))); return json_encode($viewData); }