本文整理汇总了PHP中Agent::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Agent::create方法的具体用法?PHP Agent::create怎么用?PHP Agent::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* 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.');
}
示例2: store
/**
* 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');
}
示例3: createAccount
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@exotic-intl.com', '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';
}
示例4: create
/**
* 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']);
}
示例5: create_object
public function create_object($data)
{
$data['avatar'] = $data['avatar'] ? $data['avatar'] : 'default.png';
return Agent::create($data, True);
}