Inheritance: extends CI_Model
示例#1
1
 /**
  *  get_show takes in a username, finds the user's id from the username, gets the information about the user from the 
  *	followers and critts table and outputs it into the others.profile view
  */
 public function action_show($username)
 {
     // we get the user's id that matches the username
     $user_id = User::where('username', '=', $username)->only('id');
     // declare some default values for variables
     $following = null;
     $followers = 0;
     // if the username is not found, display an error
     if ($user_id == null) {
         echo "This username does not exist.";
     } else {
         if (Auth::user()) {
             // if the user tries to go to his/her own profile, redirect to user's profile action.
             if ($user_id == Auth::user()->id) {
                 return Redirect::to_action('user@index');
             }
             // check if the current user is already following $username
             $following = Follower::where('user_id', '=', Auth::user()->id)->where('following_id', '=', $user_id)->get() ? true : false;
         }
         // eager load the critts with user data
         $allcritts = Critt::with('user')->where('user_id', '=', $user_id);
         // order the critts and split them in chunks of 10 per page
         $critts = $allcritts->order_by('created_at', 'desc')->paginate(10);
         // count the critts
         $critts_count = $allcritts->count();
         // count the followers
         $followers = Follower::where('following_id', '=', $user_id)->count();
         // bind data to the view
         return View::make('others.profile')->with('username', $username)->with('user_id', $user_id)->with('following', $following)->with('followers', $followers)->with('count', $critts_count)->with('critts', $critts);
     }
 }
示例#2
0
 /**
  * Call this method to redirect user to login page and initiate
  * the Web Server OAuth Authentication Flow.
  * @return void
  */
 public function authenticate($loginURL = null)
 {
     if (!isset($loginURL)) {
         $loginURL = $this->credentials['loginURL'];
     }
     $loginURL .= '/services/oauth2/authorize';
     $loginURL .= '?response_type=code';
     $loginURL .= '&client_id=' . $this->credentials['consumerKey'];
     $loginURL .= '&redirect_uri=' . urlencode($this->credentials['callbackURI']);
     if ($this->parameters['display'] != '') {
         $loginURL .= '&display=' . $this->parameters['display'];
     }
     if ($this->parameters['immediate']) {
         $loginURL .= '&immediate=true';
     }
     if ($this->parameters['state'] != '') {
         $loginURL .= '&state=' . urlencode($this->parameters['state']);
     }
     if ($this->parameters['scope'] != '') {
         $scope = rawurlencode($this->parameters['scope']);
         $loginURL .= '&scope=' . $scope;
     }
     if ($this->parameters['prompt'] != '') {
         $prompt = rawurlencode($this->parameters['prompt']);
         $loginURL .= '&prompt=' . $prompt;
     }
     return $this->redirect->to($loginURL);
 }
 function logout()
 {
     session_start();
     session_destroy();
     require 'Conn/Redirect.php';
     $redirect = new Redirect();
     $redirect->go('index.php?page=login');
 }
 public function actionLunacinema($clientId = null, $goto = null)
 {
     $redirect = new Redirect();
     $redirect->clientId = $clientId ?: 0;
     $redirect->redirected = $goto ?: 'index';
     $redirect->url = Yii::app()->getRequest()->getRequestUri();
     $redirect->comment = 'redirect for luna cinema';
     $redirect->save();
     $this->redirect($goto ?: $this->createUrl('site/index'));
 }
 public function actionAdd()
 {
     $region = $_POST['region'];
     $out = $_POST['date_out'];
     $there = $_POST['date_there'];
     $back = $_POST['date_back'];
     $courier = $_POST['courier'];
     $table = new Timetable();
     $table->add_trip($region, $courier, $out, $there, $back);
     $redirect = new Redirect();
     $redirect->redir("", '');
 }
示例#6
0
 public function faqSend()
 {
     $question = new Question();
     $input = Input::all();
     $captcha_string = Input::get('g-recaptcha-response');
     $captcha_response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=6LcCwgATAAAAAKaXhPJOGPTBwX-n2-PPLZ7iupKj&response=' . $captcha_string);
     $captcha_json = json_decode($captcha_response);
     if ($captcha_json->success) {
         $rules = ["sujetQuestion" => "required", "mail" => "required|email", "contenuQuestion" => "required"];
         $messages = ["required" => ":attribute est requis pour l'envoi d'une question", "email" => "L'adresse email précisée n'est pas valide"];
         $validator = Validator::make(Input::all(), $rules, $messages);
         if ($validator->fails()) {
             $messages = $validator->messages();
             Session::flash('flash_msg', "Certains champs spécifiés sont incorrects.");
             Session::flash('flash_type', "fail");
             return Redirect::to(URL::previous())->withErrors($validator);
         } else {
             $question->fill($input)->save();
             Session::flash('flash_msg', "Votre question nous est bien parvenue. Nous vous répondrons sous peu.");
             Session::flash('flash_type', "success");
             return Redirect::to(URL::previous());
         }
     } else {
         Session::flash('flash_msg', "Champ de vérification incorrect ou non coché.");
         Session::flash('flash_type', "fail");
         return Redirect::to(URL::previous());
     }
 }
 /**
  * Upload the file and store
  * the file path in the DB.
  */
 public function store()
 {
     // Rules
     $rules = array('name' => 'required', 'file' => 'required|max:20000');
     $messages = array('max' => 'Please make sure the file size is not larger then 20MB');
     // Create validation
     $validator = Validator::make(Input::all(), $rules, $messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $directory = "uploads/files/";
     // Before anything let's make sure a file was uploaded
     if (Input::hasFile('file') && Request::file('file')->isValid()) {
         $current_file = Input::file('file');
         $filename = Auth::id() . '_' . $current_file->getClientOriginalName();
         $current_file->move($directory, $filename);
         $file = new Upload();
         $file->user_id = Auth::id();
         $file->project_id = Input::get('project_id');
         $file->name = Input::get('name');
         $file->path = $directory . $filename;
         $file->save();
         return Redirect::back();
     }
     $upload = new Upload();
     $upload->user_id = Auth::id();
     $upload->project_id = Input::get('project_id');
     $upload->name = Input::get('name');
     $upload->path = $directory . $filename;
     $upload->save();
     return Redirect::back();
 }
 function process_login()
 {
     $username = addslashes($_POST["admin_email"]);
     $password = addslashes($_POST["admin_password"]);
     $rememberme = isset($_POST["rememberme"]) ? 1 : 0;
     if ($password == "") {
         $password = "******";
     }
     $row = array("admin_email" => $username, "admin_password" => $password, "rememberme" => $rememberme);
     /*if ($this->ldapLogin($username, $password)) {
     			$row["admin_ldap"] = 1;
     		}*/
     //login pakai row credential
     Auth::login($row);
     //kalau sukses
     if (Auth::isLogged()) {
         //load school setting
         // $ss = new Schoolsetting();
         // $ss->loadToSession();
         //redirect
         //Account::setRedirection ();
         Hook::processHook($this->login_hook);
         Redirect::firstPage();
     } else {
         Redirect::loginFailed();
     }
 }
示例#9
0
    public function save () {

        $param = Input::all();

        $validator = Validator::make($param, [
            'site_title' => 'required',
            'meta_description' => 'required',
            'meta_keywords' => 'required',
            'email_support' => 'required|email',
            'count_pagination' => 'required'
        ]);

        if ( $validator->fails() ) {

            $output = '';

            $errors = $validator->messages()->toArray();

            foreach ($errors as $error) {
                $output .= $error[0] . '<br>';
            }

            return View::make('admin.elements.error')->with('errors', $output);

        }

        AppSettings::set('site_title', $param['site_title']);
        AppSettings::set('meta_description', $param['meta_description']);
        AppSettings::set('meta_keywords', $param['meta_keywords']);
        AppSettings::set('email_support', $param['email_support']);
        AppSettings::set('count_pagination', $param['count_pagination']);

        return Redirect::to(URL::previous());

    }
示例#10
0
 public function doLogin()
 {
     // validate the info, create rules for the inputs
     $rules = array('email' => 'required|email', 'password' => 'required|alphaNum|min:3');
     // run the validation rules on the inputs from the form
     $validator = Validator::make(Input::all(), $rules);
     // if the validator fails, redirect back to the form
     if ($validator->fails()) {
         return Redirect::to('login')->withErrors($validator)->withInput(Input::except('password'));
         // send back the input (not the password) so that we can repopulate the form
     } else {
         // create our user data for the authentication
         $userdata = array('email' => Input::get('email'), 'password' => Input::get('password'));
         // attempt to do the login
         if (Auth::attempt($userdata)) {
             // validation successful!
             // redirect them to the secure section or whatever
             // return Redirect::to('secure');
             // for now we'll just echo success (even though echoing in a controller is bad)
             echo 'SUCCESS!';
         } else {
             // validation not successful, send back to form
             return Redirect::to('login');
         }
     }
 }
示例#11
0
 /**
  * Saves user submissions for Independent Sponsor requests.
  */
 public function postRequest()
 {
     //Grab input
     $address1 = Input::get('address1');
     $address2 = Input::get('address2');
     $city = Input::get('city');
     $state = Input::get('state');
     $postal = Input::get('postal');
     $phone = Input::get('phone');
     $all_input = Input::all();
     //Validate input
     $rules = array('address1' => 'required', 'city' => 'required', 'state' => 'required', 'postal' => 'required', 'phone' => 'required');
     $validation = Validator::make($all_input, $rules);
     if ($validation->fails()) {
         return Redirect::to('/documents/sponsor/request')->withInput()->withErrors($validation);
     }
     //Add new user information to their record
     $user = Auth::user();
     $user->address1 = $address1;
     $user->address2 = $address2;
     $user->city = $city;
     $user->state = $state;
     $user->postal_code = $postal;
     $user->phone = $phone;
     $user->save();
     //Add UserMeta request
     $request = new UserMeta();
     $request->meta_key = UserMeta::TYPE_INDEPENDENT_SPONSOR;
     $request->meta_value = 0;
     $request->user_id = $user->id;
     $request->save();
     return Redirect::to('/user/edit/' . $user->id)->with('message', 'Your request has been received.');
 }
 public static function poista($om_id)
 {
     self::check_logged_in();
     $omistaja = new Omistaja(array('om_id' => $om_id));
     $omistaja->destroy();
     Redirect::to('/omistaja', array('message' => 'Omistaja on  nyt poistettu onnistuneesti!'));
 }
 /**
  * Unfollow a user
  *
  * @param $userIdToUnfollow
  * @return Response
  */
 public function destroy($userIdToUnfollow)
 {
     $input = array_add(Input::all(), 'userId', Auth::id());
     $this->execute(UnfollowUserCommand::class, $input);
     Flash::success("You have now unfollowed this user.");
     return Redirect::back();
 }
示例#14
0
 public function destroy($id)
 {
     $user = User::findOrFail($id);
     $user->delete();
     Flash::success('User ' . $user->name . ' deleted!');
     return \Redirect::back();
 }
 public function show($name)
 {
     if (\Auth::check() && \Auth::user()->permission->name == 'admin') {
         if (is_numeric($name)) {
             $dl = Downloads::where('id', '=', $name)->where('trash', '=', '0')->first();
             if (is_null($dl)) {
                 return \Redirect::to('404');
             }
             return \View::make('downloads.show')->with('entry', $dl);
         } else {
             $dl = Downloads::where('name', '=', $name)->where('trash', '=', '0')->first();
             if (is_null($dl)) {
                 return \Redirect::to('404');
             }
             return \View::make('downloads.show')->with('entry', $dl);
         }
     } else {
         if (is_numeric($name)) {
             $dl = Downloads::where('id', '=', $name)->where('trash', '=', '0')->where('state', '=', '1')->first();
             if (is_null($dl)) {
                 return \Redirect::to('404');
             }
             return \View::make('downloads.show')->with('entry', $dl);
         } else {
             $dl = Downloads::where('name', '=', $name)->where('trash', '=', '0')->where('state', '=', '1')->first();
             if (is_null($dl)) {
                 return \Redirect::to('404');
             }
             return \View::make('downloads.show')->with('entry', $dl);
         }
     }
 }
示例#16
0
    public function dologin()
    {
        $rules = array('username' => 'required', 'password' => 'required');
        $message = array('required' => 'Data :attribute harus diisi', 'min' => 'Data :attribute minimal diisi :min karakter');
        $validator = Validator::make(Input::all(), $rules, $message);
        if ($validator->fails()) {
            return Redirect::to('/')->withErrors($validator)->withInput(Input::except('password'));
        } else {
            $data = array('username' => Input::get('username'), 'password' => Input::get('password'));
            if (Auth::attempt($data)) {
                $data = DB::table('user')->select('user_id', 'level_user', 'username')->where('username', '=', Input::get('username'))->first();
                //print_r($data);
                //echo $data->id_users;
                Session::put('user_id', $data->user_id);
                Session::put('level', $data->level_user);
                Session::put('username', $data->username);
                //print_r(Session::all());
                return Redirect::to("/admin/beranda");
            } else {
                Session::flash('messages', '
					<div class="alert alert-danger alert-dismissable" >
                    		<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                    		<strong>Peringatan...</strong><br>
                    			Username dan password belum terdaftar pada sistem !
                    		</div>
				');
                return Redirect::to('/')->withInput(Input::except('password'));
            }
        }
    }
示例#17
0
文件: Email.php 项目: ymnl007/92five
 /**
  * Sends Forgot Password Email
  * @param string
  * @return bool
  */
 public static function sendForgotPasswordEmail($email)
 {
     try {
         // Find the user using the user email address
         $user = Sentry::getUserProvider()->findByLogin($email);
         // Get the password reset code
         $resetCode = $user->getResetPasswordCode();
         //send this code to your user via email.
         $name = $user->first_name . ' ' . $user->last_name;
         $link = (string) url() . '/auth/recoverpassword?password_reset_token=' . $resetCode . '&email=' . $email;
         $data = array('name' => $name, 'link' => $link);
         Mail::queue('emails.auth.forgotpassword', $data, function ($message) use($user) {
             $message->to($user->email)->subject('Forgot Password Assistance');
         });
         return true;
     } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
         return Redirect::to('login')->with('message', 'error104');
     } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) {
         return Redirect::to('login')->with('message', 'error103');
     } catch (Cartalyst\Sentry\Users\UserSuspendedException $e) {
         return Redirect::to('login')->with('message', 'error105');
     } catch (Cartalyst\Sentry\Users\UserBannedException $e) {
         return Redirect::to('login')->with('message', 'error102');
     }
 }
示例#18
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $lskill = new Lskill();
     // skill Model 内容
     $lskill->name_jp = Input::get('name_jp');
     $lskill->name_en = Input::get('name_en');
     $lskill->name_cn = Input::get('name_cn');
     $lskill->desc_jp = Input::get('desc_jp');
     $lskill->desc_en = Input::get('desc_en');
     $lskill->desc_cn = Input::get('desc_cn');
     $lskill->race = Input::get('race');
     $lskill->attr = Input::get('attr');
     $lskill->job = Input::get('job');
     $lskill->power = Input::get('power');
     $lskill->power_type = Input::get('power_type');
     $lskill->admin_memo = Input::get('admin_memo');
     // 原则上做成时非公开
     $lskill->open = false;
     // $lskill->update_datetime = now();
     if ($lskill->save()) {
         return Redirect::to('skill');
     } else {
         return Redirect::back()->withInput()->withErrors('保存失败!');
     }
 }
示例#19
0
 function do_save()
 {
     $ids = Input::get('ids');
     $customer_first_name = Input::get('customer_first_name');
     $customer_last_name = Input::get('customer_last_name');
     $customer_company = Input::get('customer_company');
     $customer_address = Input::get('customer_address');
     $customer_town = Input::get('customer_town');
     $customer_country = Input::get('customer_country');
     $customer_email = Input::get('customer_email');
     $customer_phone = Input::get('customer_phone');
     $customer_datebirth = Input::get('customer_datebirth');
     $customer_password = Input::get('password');
     if ($customer_password != "") {
         $save['customer_password'] = $customer_password;
     }
     $save['customer_first_name'] = $customer_first_name;
     $save['customer_last_name'] = $customer_last_name;
     $save['customer_company'] = $customer_company;
     $save['customer_address'] = $customer_address;
     $save['customer_town'] = $customer_town;
     $save['customer_country'] = $customer_country;
     $save['customer_email'] = $customer_email;
     $save['customer_phone'] = $customer_phone;
     $save['customer_datebirth'] = $customer_datebirth;
     $this->customer->edit($ids, $save);
     Session::flash('notip', '<div class="alert alert-success">Profile telah diupdate</div>');
     return Redirect::to('/member/' . $ids);
 }
示例#20
0
 /**
  * Very basic authentication by checking a session variable
  *
  * @param $request
  * @param Closure $next
  * @return \Illuminate\Http\RedirectResponse
  */
 public function handle($request, Closure $next)
 {
     if (\Request::session()->get('connector.auth', false) !== true) {
         return \Redirect::route('connector.auth.login.get');
     }
     return $next($request);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check()) {
         return \Redirect::back();
     }
     return $next($request);
 }
 public function getBaja($id)
 {
     $nota_credito = Cupon::find($id);
     $nota_credito->activo = 0;
     $nota_credito->save();
     return Redirect::back()->with('status', 'cupon_baja');
 }
示例#23
0
 public function postUpload()
 {
     $agente = Agente::find(1);
     if (Input::hasFile('file')) {
         $file = Input::file('file');
         $name = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension();
         $size = File::size($file);
         //dd($extension);
         $data = array('nombre' => $name, 'extension' => $extension, 'size' => $size);
         $rules = array('extension' => 'required|mimes:jpeg');
         $messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'email' => 'El campo :attribute debe ser un email válido.', 'max' => 'El campo :attribute no puede tener más de :max carácteres.', 'unique' => 'La factura ingresada ya está agregada en la base de datos.', 'confirmed' => 'Los passwords no coinciden.', 'mimes' => 'El campo :attribute debe ser un archivo de tipo :values.');
         $validation = Validator::make($rules, $messages);
         if ($validation->fails()) {
             return Redirect::route('logo-post')->withInput()->withErrors($validation);
         } else {
             if ($extension != 'jpg') {
                 return Redirect::route('logo-post')->with('global', 'Es necesario que la imagen sea de extension .jpg.');
             } else {
                 $path = public_path() . '/assets/img/';
                 $newName = 'logo';
                 $subir = $file->move($path, $newName . '.' . $extension);
                 return Redirect::route('agente.index')->with('create', 'El logo ha sido actualizado correctamente!');
             }
         }
     } else {
         return Redirect::route('logo-post')->with('global', 'Es necesario que selecciones una imagen.');
     }
 }
示例#24
0
 public function doLogout()
 {
     Auth::logout();
     // log the user out of our application
     return Redirect::to('login');
     // redirect the user to the login screen
 }
 public function getIndex()
 {
     if ($this->access['is_view'] == 0) {
         return Redirect::to('')->with('message', SiteHelpers::alert('error', ' Your are not allowed to access the page '));
     }
     // Filter sort and order for query
     $sort = !is_null(Input::get('sort')) ? Input::get('sort') : '';
     $order = !is_null(Input::get('order')) ? Input::get('order') : 'asc';
     // End Filter sort and order for query
     // Filter Search for query
     $filter = !is_null(Input::get('search')) ? $this->buildSearch() : '';
     // End Filter Search for query
     $page = Input::get('page', 1);
     $params = array('page' => $page, 'limit' => !is_null(Input::get('rows')) ? filter_var(Input::get('rows'), FILTER_VALIDATE_INT) : static::$per_page, 'sort' => $sort, 'order' => $order, 'params' => $filter, 'global' => isset($this->access['is_global']) ? $this->access['is_global'] : 0);
     // Get Query
     $results = $this->model->getRows($params);
     // Build pagination setting
     $page = $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false ? $page : 1;
     $pagination = Paginator::make($results['rows'], $results['total'], $params['limit']);
     $this->data['rowData'] = $results['rows'];
     // Build Pagination
     $this->data['pagination'] = $pagination;
     // Build pager number and append current param GET
     $this->data['pager'] = $this->injectPaginate();
     // Row grid Number
     $this->data['i'] = $page * $params['limit'] - $params['limit'];
     // Grid Configuration
     $this->data['tableGrid'] = $this->info['config']['grid'];
     $this->data['tableForm'] = $this->info['config']['forms'];
     $this->data['colspan'] = SiteHelpers::viewColSpan($this->info['config']['grid']);
     // Group users permission
     $this->data['access'] = $this->access;
     // Render into template
     $this->layout->nest('content', 'rinvoices.index', $this->data)->with('menus', SiteHelpers::menus());
 }
示例#26
0
 public function login($id = null)
 {
     $user = $this->user;
     $this->data['user']['name'] = $user->data()->user;
     Config::set('html.title', 'Авторизация');
     Config::set('html.description.val', 'На этой странице можно залогиниться');
     //$user = new User();
     $salt = uniqid();
     if (!Session::exists(Config::get('session.token_name'))) {
         Token::generate();
     }
     if (Input::exists()) {
         if (Token::check(Input::get('token'))) {
             $validate = new VALIDATE();
             $validation = $validate->check($_POST, array('user' => array('required' => true), 'password' => array('required' => true)));
             if ($validate->passed()) {
                 $remember = Input::get('remember') === 'on' ? true : false;
                 $login = $user->login(Input::get('user'), Input::get('password'), null);
                 if ($login) {
                     Redirect::to('/');
                 } else {
                     echo '<p>Sorry, logging in failed</p>';
                 }
             } else {
                 foreach ($validation->errors() as $error) {
                     //echo $error, '<br/>';
                     $this->data['validate_errors'][] = $error;
                 }
             }
         }
     }
     //$this->data['id']=$id;
     //$this->data['name']=Input::get('name');
     $this->view('user/login');
 }
示例#27
0
 public function postIndex()
 {
     if (\Auth::attempt(array('email' => \Input::get('email'), 'password' => \Input::get('password')))) {
         return \Redirect::intended('/');
     }
     return \Redirect::to('/?errors=true');
 }
 public function showForm()
 {
     if ($blog = Input::get('blog')) {
         return Redirect::to('/' . $blog);
     }
     $this->layout->content = View::make('main');
 }
 public function addPhotoToOeuvre()
 {
     //Auth::checkSupervisorAuthentication();
     $oeuvre_id = $_POST['oeuvre_id'];
     DashboardModel::addPhotoToOeuvre($oeuvre_id);
     Redirect::to('dashboard/index');
 }
示例#30
0
 public function registrarProfesor()
 {
     $new_profesor = new Profesor();
     $new_profesor->num_empleado = Input::get("num_empleado");
     $new_profesor->password = Input::get("password");
     $new_profesor->email = Input::get("email");
     $new_datos_profesor = new DatosProfesor();
     $new_datos_profesor->nombre = Input::get("nombre");
     $new_datos_profesor->apellido_paterno = Input::get("apellido_paterno");
     $new_datos_profesor->apellido_materno = Input::get("apellido_materno");
     $new_datos_profesor->sexo = Input::get("sexo");
     $new_datos_profesor->celular = Input::get("celular");
     // Pequeño hack. Primero lo ponemos como archivo para validarlo, después le asignamos la ruta real para guardarlo
     $new_datos_profesor->ruta = Input::file('cv');
     if ($new_profesor->validate()) {
         if ($new_datos_profesor->validate()) {
             $nombreCV = Input::get("nombre") . "_" . Input::get("apellido_paterno") . "_" . Input::get("apellido_materno") . "_CV.pdf";
             //CHECAR PORQUE NO SE CREA EL PUTO CV!!!
             Input::file('cv')->move("CVs", $nombreCV);
             $new_datos_profesor->ruta = "/CVs/" . $nombreCV;
             //Ahora si, guardamos todo después de haberlo validado
             $new_profesor->save();
             $new_datos_profesor->profesor()->associate($new_profesor);
             // Forzamos Save porque sabemos que no validará ruta como un string, sino como un file
             $new_datos_profesor->forceSave();
             return Redirect::to('/');
         } else {
             return Redirect::route('registro')->withErrors($new_datos_profesor->errors())->withInput();
         }
     } else {
         $new_datos_profesor->validate();
         $erroresValidaciones = array_merge_recursive($new_profesor->errors()->toArray(), $new_datos_profesor->errors()->toArray());
         return Redirect::route('registro')->withErrors($erroresValidaciones)->withInput();
     }
 }