/** * Store a newly created resource in storage. * * @return Response */ public function store() { $input = Input::all(); $validation = Validator::make($input, Agent::$rules); if ($validation->passes()) { $this->agent->create($input); return Redirect::route('admin.agents.index'); } return Redirect::route('admin.agents.create')->withInput()->withErrors($validation)->with('message', 'There were validation errors.'); }
/** * Store a newly created agent in storage. * * @return Response */ public function store() { $validator = Validator::make($data = Input::all(), Agent::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } Agent::create($data); return Redirect::route('control-panel.agents.index'); }
public function createAccount() { $validator = Validator::make($data = Input::all(), User::$rules); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $data['role'] = Input::get('user_role'); $data['country_id'] = Input::get('country'); $data['password'] = Hash::make($data['password']); $data['code'] = str_random(60); //Activation code $user = User::create($data); if ($user) { $data['user_id'] = $user->id; if ($data['role'] == 'Agent') { $data['market_id'] = Market::where('market', 'All Market')->first()->id; $role = Role::where('name', $data['role'])->first(); $user->attachRole($role); Agent::create($data); Mail::send('emails.auth.signup', array('first_name' => $data['first_name'], 'role' => $data['role']), function ($massage) use($user) { $massage->to($user->email, $user->first_name)->subject('Thank You for Signing Up'); }); Mail::send('emails.auth.signup', array('first_name' => $data['first_name'], 'role' => $data['role']), function ($massage) use($user) { $massage->to('*****@*****.**', 'Tharinda')->subject('Thank You for Signing Up'); }); Session::flash('global', 'Thank you for signing up with us as an ' . $data['role'] . '. We will contact you within 24 hours'); return View::make('pages.message'); } if ($data['role'] == 'Hotelier') { Mail::send('emails.auth.signup', array('first_name' => $data['first_name'], 'role' => $data['role']), function ($massage) use($user) { $massage->to($user->email, $user->first_name)->subject('Thank You for Signing Up'); }); Session::flash('global', 'Thank you for signing up with us as an ' . $data['role'] . '. We will contact you within 24 hours'); return View::make('pages.message'); } // send email Mail::send('emails.auth.activate', array('link' => URL::to('account/activate', $data['code']), 'first_name' => $data['first_name']), function ($massage) use($user) { $massage->to($user->email, $user->first_name)->subject('Activate your account'); }); Session::flash('global', 'Your account has been created! We have sent you an email to activate your account'); return View::make('pages.message'); } return 'There was an error'; }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return Agent::create(['agent_first_name' => $data['agent_first_name'], 'agent_middle_name' => $data['agent_middle_name'], 'agent_last_name' => $data['agent_last_name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'agency_id' => '1']); }
public function create_object($data) { $data['avatar'] = $data['avatar'] ? $data['avatar'] : 'default.png'; return Agent::create($data, True); }