app/Http/Controllers/AccountController.php
/**
     * Store a newly created resource in storage.
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function postCreate(Request $request)
    {
        $validator = Validator::make(Input::all(),
            [
                'email'    => 'required|max:50|email|unique:users',
                'username' => 'required|between:3,20|alpha_num|unique:users',
                'password' => 'required|min:6|confirmed',
                'password_confirmation' => 'required|same:password'
        ]);
        if ($validator->fails()) {
            return Redirect::route('account-create')->withErrors($validator)
                                                    ->withInput(Input::except('password'));
        }else{
            $code = str_random(60);
            $create = User::create([
                'email' => Input::get('email'),
                'username' => Input::get('username'),
                'password' => bcrypt(Input::get('password')),
                'code' => $code,
                'active' => 0
            ]);
            if ($create) {
                \Mail::send('email.activate',
                           ['username' => $create->username,
                           'link' => \URL::route('account-activate', $code)],
                           function ($m) use ($create) {
                                $m->from('victortraian92@gmail.com', 'Embassy Pub');
                                $m->to($create->email, $create->username)
                                  ->subject('Activate your account');
                           }
                );
                return Redirect::route('home')
                    ->with('global', 'Your account has been created! 
                        We have sent you an email to activate your account.');
            }
        }
    }
public function postCreate ( Request $ request ) { $ validator = Validator :: make ( Input :: all ( ) , [ 'email' => 'required|max:50|email|unique:users' , 'username' => 'required|between:3,20|alpha_num|unique:users' , 'password' => 'required|min:6|confirmed' , 'password_confirmation' => 'required|same:password' ] ) ; if ( $ validator -> fails ( ) ) { return Redirect :: route ( 'account-create' ) -> withErrors ( $ validator ) -> withInput ( Input :: except ( 'password' ) ) ; } else { $ code = str_random ( 60 ) ; $ create = User :: create ( [ 'email' => Input :: get ( 'email' ) , 'username' => Input :: get ( 'username' ) , 'password' => bcrypt ( Input :: get ( 'password' ) ) , 'code' => $ code , 'active' => 0 ] ) ; if ( $ create ) { \ Mail :: send ( 'email.activate' , [ 'username' => $ create -> username , 'link' => \ URL :: route ( 'account-activate' , $ code ) ] , function ( $ m ) use ( $ create ) { $ m -> from ( 'victortraian92@gmail.com' , 'Embassy Pub' ) ; $ m -> to ( $ create -> email , $ create -> username ) -> subject ( 'Activate your account' ) ; } ) ; return Redirect :: route ( 'home' ) -> with ( 'global' , 'Your account has been created! 
                        We have sent you an email to activate your account.' ) ; } } }
Store a newly created resource in storage.
Store a newly created resource in storage .