/** * Show the admin panel. * * @param App\Repositories\ContactRepository $contact_gestion * @param App\Repositories\BlogRepository $blog_gestion * @param App\Repositories\CommentRepository $comment_gestion * @return Response */ public function admin(ContactRepository $contact_gestion, BlogRepository $blog_gestion, CommentRepository $comment_gestion) { $nbrMessages = $contact_gestion->getNumber(); $nbrUsers = $this->user_gestion->getNumber(); $nbrPosts = $blog_gestion->getNumber(); $nbrComments = $comment_gestion->getNumber(); return view('back.index', compact('nbrMessages', 'nbrUsers', 'nbrPosts', 'nbrComments')); }
/** * Show the media panel. * * @return Response */ public function filemanager(ContactRepository $contact_gestion, BlogRepository $blog_gestion, CommentRepository $comment_gestion) { $url = config('medias.url'); $nbrMessages = $contact_gestion->getNumber(); $nbrUsers = $this->user_gestion->getNumber(); $nbrPosts = $blog_gestion->getNumber(); $nbrComments = $comment_gestion->getNumber(); return view('back.filemanager', compact('url', 'nbrMessages', 'nbrUsers', 'nbrPosts', 'nbrComments')); }
/** * Show the admin panel. * * @param App\Repositories\ContactRepository $contact_gestion * @param App\Repositories\BlogRepository $blog_gestion * @param App\Repositories\CommentRepository $comment_gestion * @return Response */ public function admin(ContactRepository $contact_gestion, BlogRepository $blog_gestion, CommentRepository $comment_gestion) { $nbrMessages = $contact_gestion->getNumber(); $nbrUsers = $this->user_gestion->getNumber(); $nbrPosts = $blog_gestion->getNumber(); $nbrComments = $comment_gestion->getNumber(); $tasklistall = Tasklist::all(); Session::put('tasklisttkey', $tasklistall); $taskcount = Tasklist::count(); Session::put('taskcountkey', $taskcount); return view('back.index', compact('nbrMessages', 'nbrUsers', 'nbrPosts', 'nbrComments', 'taskcountkey', 'tasklisttkey')); }
/** * Send contact message * * @return string */ public function postSendContactMessage() { try { //Set validation rules $this->form_validation->set_rules('first_name', 'First Name', 'required|xss_clean'); $this->form_validation->set_rules('last_name', 'Last Name', 'required|xss_clean'); $this->form_validation->set_rules('email', 'Email', 'required|valid_email|xss_clean'); $this->form_validation->set_rules('message', 'Message', 'required|min_length[300]|xss_clean'); //Run validation if ($this->form_validation->run() == false) { //Our form is not valid, so sad!! //Define list of fields $fieldNames = ['first_name', 'last_name', 'email', 'message']; //Set error delimiter $this->form_validation->set_error_delimiters('<small class="help-block server-error">', '</small>'); //Loop through all fields and put error foreach ($fieldNames as $fieldName) { //We have value for the field if (isset($_POST[$fieldName]) && !empty($_POST[$fieldName])) { //Put value in keeper $this->keeper->put($fieldName . '_value', $_POST[$fieldName]); } //There is an error on the field if (form_error($fieldName) != '') { //Keep error in the keeper $this->keeper->put($fieldName . '_error', form_error($fieldName)); } } //Redirect on login-register page redirect('/contact-us', 'location'); } //Create new contact message $message = $this->contactMessageRepo->saveMessage($this->input->post()); //Send email $this->email->from($this->input->post('email'), $message->first_name . ' ' . $message->last_name . ' via UOM-Connect contact'); $this->email->to('*****@*****.**'); $this->email->subject('Help Needed'); $this->email->message($this->load->view('emails/contact-email', ['contact' => $message], true)); $this->email->send(); //Alert success $notif = 'Your message has been sent successfully. We will get back to you as soon as possible.'; $this->keeper->put('notificationSuccess', $notif); //Redirect to contact page redirect('/contact-us', 'location'); } catch (Exception $e) { //Unexpected error show_error($e->getCode()); } }
/** * Remove the specified resource from storage. * * @param App\Repositories\ContactRepository $contact_gestion * @param int $id * @return Response */ public function destroy(ContactRepository $contact_gestion, $id) { $contact_gestion->destroy($id); return redirect('contact'); }