app/controllers/UserController.php
/**
	 * Store a newly created resource in storage.
	 *
	 * @return Response
	 */
Store a newly created resource in storage.
@return Response
Store a newly created resource in storage . @return Response
public function store()
	{
        $usern = Input::get('username');
		$pass  = Input::get('password');
        $email = Input::get('email');
        $cntry = Input::get('country');
        $validator = Validator::make(
            array(
                'username'  => $usern,
                'password'  => $pass,
                'email'     => $email
            ),
            array(
                'username'  => 'required|unique:users',
                'password'  => 'required|min:8',
                'email'     => 'required|email|unique:users'
            )
        );
        if ($validator->fails())
        {
            $messages = $validator->messages();
            return Redirect::back()->withErrors($messages);
        }
        $user = new User();
        $user->username   = $usern;
        $user->password   = Hash::make($pass);
        $user->email      = $email;
        $user->first_name = '';
        $user->last_name  = '';
        $user->address1   = '';
        $user->address2   = '';
        $user->apt_suite  = '';
        $user->city       = '';
        $user->state      = '';
        $user->country    = $cntry;
        $user->zip        = '';
        $user->admin      = false;
        $user->active     = true;
        $user->created_at = time();
        $user->updated_at = time();
        $user->last_login = time();
        $user->save();
        if (Auth::attempt(array('email' => $email, 'password' => $pass)))
        {
            return Redirect::route('home.index');
        }
        else Redirect::route('session.create');
	}
public function store ( ) { $ usern = Input :: get ( 'username' ) ; $ pass = Input :: get ( 'password' ) ; $ email = Input :: get ( 'email' ) ; $ cntry = Input :: get ( 'country' ) ; $ validator = Validator :: make ( array ( 'username' => $ usern , 'password' => $ pass , 'email' => $ email ) , array ( 'username' => 'required|unique:users' , 'password' => 'required|min:8' , 'email' => 'required|email|unique:users' ) ) ; if ( $ validator -> fails ( ) ) { $ messages = $ validator -> messages ( ) ; return Redirect :: back ( ) -> withErrors ( $ messages ) ; } $ user = new User ( ) ; $ user -> username = $ usern ; $ user -> password = Hash :: make ( $ pass ) ; $ user -> email = $ email ; $ user -> first_name = '' ; $ user -> last_name = '' ; $ user -> address1 = '' ; $ user -> address2 = '' ; $ user -> apt_suite = '' ; $ user -> city = '' ; $ user -> state = '' ; $ user -> country = $ cntry ; $ user -> zip = '' ; $ user -> admin = false ; $ user -> active = true ; $ user -> created_at = time ( ) ; $ user -> updated_at = time ( ) ; $ user -> last_login = time ( ) ; $ user -> save ( ) ; if ( Auth :: attempt ( array ( 'email' => $ email , 'password' => $ pass ) ) ) { return Redirect :: route ( 'home.index' ) ; } else Redirect :: route ( 'session.create' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .