public function postCreateNew() { $cre = ['cv_name' => Input::get('cv_name'), 'email' => Input::get('email')]; $rules = ['cv_name' => 'required', 'email' => 'required|email']; $validator = Validator::make($cre, $rules); if ($validator->passes()) { $cv = new Cv(); do { $random = str_random(10); $count = Cv::where('cv_code', $random)->count(); } while ($count != 0); $cv->cv_code = $random; if (Auth::check()) { $cv->user_id = Auth::id(); } $cv->cv_name = Input::get('cv_name'); $cv->email = Input::get('email'); $cv->save(); $cv_id = $cv->id; DB::table('sections')->insert(array(array("cv_id" => "{$cv_id}", "section_name" => "Work Experience", "type" => "1", "priority" => "1", "default" => "1"), array("cv_id" => "{$cv_id}", "section_name" => "Qualfications", "type" => "0", "priority" => "2", "default" => "1"), array("cv_id" => "{$cv_id}", "section_name" => "Education", "type" => "2", "priority" => "3", "default" => "1"), array("cv_id" => "{$cv_id}", "section_name" => "NYSC", "type" => "3", "priority" => "4", "default" => "1"), array("cv_id" => "{$cv_id}", "section_name" => "Languages", "type" => "4", "priority" => "5", "default" => "1"), array("cv_id" => "{$cv_id}", "section_name" => "Passport Photo", "type" => "5", "priority" => "6", "default" => "1"), array("cv_id" => "{$cv_id}", "section_name" => "Interests", "type" => "0", "priority" => "7", "default" => "1"), array("cv_id" => "{$cv_id}", "section_name" => "References", "type" => "0", "priority" => "8", "default" => "1"))); return Redirect::to('/cvbuilder/cv/' . $cv->cv_code); } else { return Redirect::Back()->withErrors($validator)->withInput(); } }
public function postSaveadd() { $cre = ['name' => Input::get('name'), 'email' => Input::get('email'), 'enquiry' => Input::get('enquiry'), 'message' => Input::get('message')]; $rules = ['name' => 'required', 'email' => 'required|email', 'enquiry' => 'required|not_in:0', 'message' => 'required']; $validator = Validator::make($cre, $rules); if ($validator->passes()) { require app_path() . '/mail.php'; require app_path() . '/libraries/PHPMailerAutoload.php'; $mail = new PHPMailer(); $mail_text = new Mail(); $mail->isMail(); $mail->setFrom('*****@*****.**', 'Corper Life'); $mail->addAddress('*****@*****.**'); $mail->addAddress('*****@*****.**'); $mail->isHTML(true); $mail->Subject = "Advertisement Request | Corper Life"; $mail->Body = $mail_text->advert(Input::get("name"), Input::get("email"), Input::get("enquiry"), Input::get("phone"), Input::get("message")); if (!$mail->send()) { return Redirect::Back()->with('failure', 'Mailer Error: ' . $mail->ErrorInfo); } else { return Redirect::Back()->with('success', 'Your enquiry has been submitted. We will respond to it asap.'); } } else { return Redirect::Back()->withErrors($validator)->withInput(); } }
public function postLogin() { $cre = ["username" => Input::get('username'), "password" => Input::get('password')]; $rules = ['username' => 'required', 'password' => 'required']; $validator = Validator::make($cre, $rules); if ($validator->passes()) { if (Auth::attempt($cre)) { return Redirect::to('/admin'); } else { return Redirect::Back()->withErrors($validator)->withInput()->with('fail', 'Username and password does not match'); } } else { return Redirect::Back()->withErrors($validator)->withInput(); } }
public function store() { $validation = Validator::make(Input::all(), Post::$rules); if ($validation->fails()) { return Redirect::Back()->withInput()->withErrors($validation->messages()); } $post = new Post(); $post->title = Input::get('title'); $post->description = Input::get('description'); $post->content_text = Input::get('content_text'); $post->user_id = Auth::user()->id; $post->point = 0; $post->status = 1; $post->save(); return Redirect::to('/'); }
public function storeProfile() { if (Auth::check()) { $validation = Validator::make(Input::all(), UserProfile::$rules); if ($validation->fails()) { return Redirect::Back()->withInput()->withErrors($validation); } $profile = UserProfile::find(Auth::User()->id); $profile->first_name = Input::get('first_name'); $profile->last_name = Input::get('last_name'); $profile->save(); return Redirect::to("user/{$profile->id}"); } else { return Redirect::to('login_index'); } }
public function register() { $reguser = array('regfirst' => Input::get('regfirst'), 'reglast' => Input::get('reglast'), 'reguser' => Input::get('reguser'), 'password' => Input::get('password'), 'cpassword' => Input::get('cpassword')); $rules = array('regfirst' => 'alpha_num|max:50', 'reglast' => 'alpha_num|max:50', 'reguser' => 'required|unique:users,username|alpha_num|min:5', 'password' => 'required|alpha_num|between:6,100', 'cpassword' => 'required|alpha_num|between:6,100|same:password'); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { return Redirect::Back()->withInput()->withErrors($validator); } else { $user = new UserModel(); $user->firstname = Input::get('regfirst'); $user->lastname = Input::get('reglast'); $user->username = Input::get('reguser'); $user->password = Hash::make(Input::get('password')); $user->roles = Input::get('roles'); $user->save(); } return Redirect::route('login')->with('flash_notice', 'You are successfully Register.'); }
public function postSaveReply($topic_id) { if (Auth::check()) { $cre = ['reply' => Input::get('reply')]; $rules = ['reply' => 'required']; $validator = Validator::make($cre, $rules); if ($validator->passes()) { $blog = new Blog(); $blog->user_id = Auth::id(); $blog->topic_id = $topic_id; $blog->reply = Input::get('reply'); $blog->save(); return Redirect::Back()->with('success', 'gfhfhfh'); } else { return Redirect::Back()->withErrors($validator)->withInput(); } } }
public function loginFailed() { return Redirect::Back()->withInput()->with('message', "Invalid email/password"); }
public function postForgot() { $cre = ['email' => Input::get('email')]; $rules = ['email' => 'required|email']; $validator = Validator::make($cre, $rules); if ($validator->passes()) { $count = DB::table("users")->where('username', Input::get('email'))->count(); if ($count > 0) { $user = User::where('username', Input::get('email'))->select('id', 'username', 'password', 'facebook_id', 'firstname')->first(); if ($user->password != -1 && empty($user->facebook_id)) { require app_path() . '/mail.php'; require app_path() . '/libraries/PHPMailerAutoload.php'; $password = str_random(8); $password_hash = Hash::make($password); $mail = new PHPMailer(); $mail_text = new Mail(); $mail->isMail(); $mail->setFrom('*****@*****.**', 'Corper Life'); $mail->addAddress($user->username); $mail->isHTML(true); $mail->Subject = "Corper Life Forgot Password"; $mail->Body = $mail_text->forgot_mail($user->firstname, $user->username, $password); if (!$mail->send()) { return Redirect::back()->with('fail', 'Mailer Error: ' . $mail->ErrorInfo)->withInput(); } else { $user->password = $password_hash; $user->save(); return Redirect::back()->with('success', 'Your password is reset and sent to your email'); } } else { return Redirect::back()->with('fail', 'This email is registered with Facebook Login')->withInput(); } } else { return Redirect::back()->with('fail', 'Email not found')->withInput(); } } else { return Redirect::Back()->withErrors($validator)->withInput(); } }
public function putnyscDetails() { $cre = ['serv_year' => Input::get('service_year'), 'batch' => Input::get('batch')]; $rules = ['serv_year' => 'required|not_in:0', 'batch' => 'required|not_in:0']; $validator = Validator::make($cre, $rules); if ($validator->passes()) { $user = User::find(Auth::id()); $user->serv_year = Input::get('service_year'); $user->batch = Input::get('batch'); $user->save(); return Redirect::to('/profile'); } else { return Redirect::Back()->withErrors($validator)->withInput(); } }
public function DeleteTopics($id) { $del = DB::table('topics')->where('id', $id)->delete(); return Redirect::Back()->with('success', 'Topic Deleted'); }
public function getmessage() { if (Payment::VeryPayment() == false) { return View::make('clinic.payment.renews-payment'); } $data = array("message" => Input::get("message")); $rules = array("message" => 'required|min:3|max:255'); $messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'max' => 'El campo :attribute no puede tener más de :max carácteres.'); $validation = Validator::make(Input::all(), $rules, $messages); //si la validación falla redirigimos al formulario de registro con los errores //y con los campos que nos habia llenado el usuario if ($validation->fails()) { return Redirect::to('/doctors/profile')->withErrors($validation)->withInput(); } else { $msg = new MgsAppointment(); $msg->appointment_id = Input::get("cita_id"); $msg->text = Input::get("message"); $msg->save(); return Redirect::Back(); } }
Route::group(['prefix' => 'cv-page', 'before' => 'auth'], function () { Route::get('/', 'UserprofileController@getcvpage'); Route::get('/duplicate/{code}', 'UserprofileController@duplicatecvpage'); Route::get('/delete/{code}', 'UserprofileController@deleteCV'); }); Route::group(['prefix' => 'content-page', 'before' => 'auth'], function () { Route::get('/', 'ForumController@getcontentpage'); }); Route::group(['prefix' => 'cvbuilder'], function () { Route::get('/', 'CVController@getIndex'); Route::post('/createnew', 'CVController@postCreateNew'); Route::post('/uploadCvPic/{code}', 'UserMediaController@uploadCvPic'); Route::post('/editcv', function () { $count = Cv::where('cv_code', Input::get('cvcode'))->count(); if ($count == 0) { return Redirect::Back()->with('fail', 'Invalid CV Code')->withInput(); } else { return Redirect::to('/cvbuilder/cv/' . Input::get('cvcode')); } }); Route::get('/cv/{id}', 'CVController@getCV'); Route::post('/saveinfo/{id}', 'CVController@putSaveInfo'); Route::get('/fetch_workex', function () { return View::make('cvbuilder.section_views.workex'); }); Route::get('/fetch_education', function () { return View::make('cvbuilder.section_views.education'); }); Route::get('/fetch_nysc', function () { return View::make('cvbuilder.section_views.nysc'); });
public function storeStudent() { $cre = ["first_group" => Input::get('first_group'), 'name' => Input::get('name'), 'dob' => Input::get('dob'), 'gender' => Input::get('gender'), 'father_name' => Input::get('father_name'), 'month_plan' => Input::get('month_plan'), 'dor' => Input::get('dor'), 'doe' => Input::get('doe'), 'dos' => Input::get('dos')]; $rules = ["first_group" => 'required', 'name' => 'required', 'dob' => 'required', 'gender' => 'required', 'father_name' => 'required', 'month_plan' => 'required', 'dor' => 'required', 'doe' => 'required', 'dos' => 'required']; $validator = Validator::make($cre, $rules); if ($validator->passes()) { $student = new Student(); $student->name = Input::get('name'); $student->dob = Input::get('dob'); $student->gender = Input::get('gender'); $student->first_group = Input::get('first_group'); $student->dos = Input::get('dos'); $student->doe = Input::get('doe'); $student->added_by = Auth::User()->id; $student->add_date = strtotime("now"); $student->save(); $student_details = new StudentDetails(); $student_details->student_id = $student->id; $student_details->school = Input::get('school_name'); $student_details->status_email = Input::get('status_email'); $student_details->status_mob = Input::get('status_mob'); $student_details->father = Input::get('father_name'); $student_details->mother = Input::get('mother'); $student_details->father_mob = Input::get('father_mob'); $student_details->father_email = Input::get('father_email'); $student_details->mother_mob = Input::get('mother_mob'); $student_details->mother_email = Input::get('mother_email'); $student_details->address = Input::get('address'); $student_details->city = Input::get('city'); $student_details->state = Input::get('state'); if (Input::hasFile('picture')) { $picture = Input::file('picture'); $filename = Input::file('picture')->getClientOriginalName(); Input::file('picture')->move('uploads/', 'st_' . $filename); $student_details->pic = 'st_' . $filename; } $student_details->father_status_email = Input::get('father_status_email'); $student_details->father_status_mob = Input::get('father_status_mob'); $student_details->mother_status_mob = Input::get('mother_status_mob'); $student_details->mother_status_email = Input::get('mother_status_email'); $student_details->save(); $payment = new PaymentHistory(); $payment->student_id = $student->id; $payment->dos = Input::get('dos'); $payment->dor = Input::get('dor'); $payment->doe = Input::get('doe'); $payment->reg_fee = Input::get('reg_fee'); $payment->sub_fee = Input::get('sub_fee'); $payment->kit_fee = Input::get('kit_fee'); $payment->amount = Input::get('amount'); $payment->months = Input::get('month_plan'); $payment->adjustment = Input::get('adjustment'); $payment->p_remark = Input::get('p_remark'); $payment->a_remark = Input::get('a_remark'); $payment->date = strtotime("now"); $payment->payment_mode = Input::get('payment_mode'); $payment->save(); return Redirect::Back()->with('success', 'New Student Added Successfully'); } return "error"; }