示例#1
0
 /**
  * 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 store(Request $request)
 {
     $validator = Validator::make($request->all(), ['first_name' => 'required', 'middle_name' => 'max:30', 'last_name' => 'required', 'email' => 'required|email|unique:candidates', 'candidate_id' => 'numeric']);
     if ($validator->fails()) {
         return back()->withErrors($validator)->withInput();
     } else {
         Candidate::create($request->all());
         return view('dashboard.home')->with('message', 'Candidate Added Successfully.');
     }
 }
示例#4
0
文件: routes.php 项目: VP42/PIMs
        $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;