本文整理汇总了PHP中Owner::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Owner::save方法的具体用法?PHP Owner::save怎么用?PHP Owner::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Owner
的用法示例。
在下文中一共展示了Owner::save方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create()
{
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$username = $_POST['username'];
$password = $_POST['password'];
$gender = $_POST['gender'];
$address = $_POST['address'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$code = $_POST['code'];
$activated = $_POST['activated'];
$owner = new Owner();
$owner->firstname = $firstname;
$owner->lastname = $lastname;
$owner->username = $username;
$owner->password = $password;
$owner->gender = $gender;
$owner->address = $address;
$owner->email = $email;
$owner->phone = $phone;
$owner->code = $code;
$owner->activated = $activated;
if ($owner->save()) {
return $this->viewTpl('owner/show.html', ['owner' => $owner]);
}
}
示例2: postTestAuthorize
public function postTestAuthorize()
{
if (!array_key_exists('X_ALLOW_TEST_AUTH', $_SERVER) || $_SERVER['X_ALLOW_TEST_AUTH'] != 'true') {
return;
}
$data = ['eduPersonPrincipalName' => Input::get('eduPersonPrincipalName'), 'eduPersonScopedAffiliation' => Input::get('eduPersonScopedAffiliation'), 'sn' => Input::get('sn'), 'givenName' => Input::get('givenName'), 'mail' => Input::get('mail')];
$user = (object) $data;
$userId = Input::get('eduPersonPrincipalName');
$owner = Owner::find($userId);
if (!$owner) {
$owner = new Owner();
$owner->id = $userId;
}
$owner->data = json_encode($user);
$owner->save();
$params = Session::get('authorize-params');
$params['user_id'] = $user->eduPersonPrincipalName;
if (Input::get('approve') !== null) {
$code = AuthorizationServer::newAuthorizeRequest('user', $params['user_id'], $params);
Session::forget('authorize-params');
return Redirect::to(AuthorizationServer::makeRedirectWithCode($code, $params));
}
if (Input::get('deny') !== null) {
Session::forget('authorize-params');
$url = AuthorizationServer::makeRedirectWithError($params);
return new \Illuminate\Http\RedirectResponse((string) $url, 302, array());
}
}
示例3: create
public function create()
{
$rules = ['ownername' => 'required', 'id_no' => 'required|numeric', 'ownerlocation' => 'required', 'ownerphone' => 'required', 'owneremail' => 'required|email', 'ownerage' => 'required', 'team_id' => 'required'];
$validation = Validator::make(Input::all(), $rules);
if ($validation->passes()) {
$rand = 'GSP' . rand(100, 100000);
$user = new Owner();
$user->ownername = Input::get('ownername');
$user->id_no = Input::get('id_no');
$user->ownerlocation = Input::get('ownerlocation');
$user->ownerphone = Input::get('ownerphone');
$user->owneremail = Input::get('owneremail');
$user->ownerage = Input::get('ownerage');
$user->team_id = Input::get('team_id');
$user->rand_num = $rand;
$user->save();
// redirect
Session::flash('message', 'Successfully created team Owners!');
return Redirect::to('all');
//return View::make('pages.register')->with('message', 'team created');
}
return Redirect::back()->withErrors($validation)->withInput();
}
示例4: userSave
public function userSave()
{
$first_name = Input::get('first_name');
$last_name = Input::get('last_name');
$email = Input::get('email');
$phone = Input::get('phone');
$password = Input::get('password');
$referral_code = Input::get('referral_code');
if (Owner::where('email', $email)->count() == 0) {
$owner = new Owner();
$owner->first_name = $first_name;
$owner->last_name = $last_name;
$owner->email = $email;
$owner->phone = $phone;
if ($password != "") {
$owner->password = Hash::make($password);
}
$owner->token = generate_token();
$owner->token_expiry = generate_expiry();
if ($referral_code != "") {
if ($ledger = Ledger::where('referral_code', $referral_code)->first()) {
$referred_by = $ledger->owner_id;
$settings = Settings::where('key', 'default_referral_bonus')->first();
$referral_bonus = $settings->value;
$ledger = Ledger::find($ledger->id);
$ledger->total_referrals = $ledger->total_referrals + 1;
$ledger->amount_earned = $ledger->amount_earned + $referral_bonus;
$ledger->save();
$owner->referred_by = $ledger->owner_id;
$response_array = array('success' => true);
$response_code = 200;
}
}
$owner->save();
// send email
$settings = Settings::where('key', 'email_owner_new_registration')->first();
$pattern = $settings->value;
$pattern = str_replace('%name%', $owner->first_name, $pattern);
$subject = "Welcome On Board";
email_notification($owner->id, 'owner', $pattern, $subject);
return Redirect::to('user/signin')->with('success', 'Ypu have successfully registered. <br>Please Login');
} else {
return Redirect::to('user/signup')->with('error', 'This email ID is already registered.');
}
}
示例5: register
//.........这里部分代码省略.........
}
$owner->device_token = $device_token;
$owner->device_type = $device_type;
$owner->bio = "";
if (Input::has('bio')) {
$owner->bio = $bio;
}
$owner->address = "";
if (Input::has('address')) {
$owner->address = $address;
}
$owner->state = "";
if (Input::has('state')) {
$owner->state = $state;
}
$owner->login_by = $login_by;
$owner->country = "";
if (Input::has('country')) {
$owner->country = $country;
}
$owner->zipcode = "0";
if (Input::has('zipcode')) {
$owner->zipcode = $zipcode;
}
if ($social_unique_id != "") {
$owner->social_unique_id = $social_unique_id;
}
$owner->timezone = 'UTC';
if (Input::has('timezone')) {
$owner->timezone = Input::get('timezone');
}
$owner->is_referee = 0;
$owner->promo_count = 0;
$owner->save();
/* $zero_in_code = Config::get('app.referral_zero_len') - strlen($owner->id);
$referral_code = Config::get('app.referral_prefix');
for ($i = 0; $i < $zero_in_code; $i++) {
$referral_code .= "0";
}
$referral_code .= $owner->id; */
regenerate:
$referral_code = my_random4_number();
if (Ledger::where('referral_code', $referral_code)->count()) {
goto regenerate;
}
/* Referral entry */
$ledger = new Ledger();
$ledger->owner_id = $owner->id;
$ledger->referral_code = $referral_code;
$ledger->save();
/* Referral entry end */
// send email
/* $subject = "Welcome On Board";
$email_data['name'] = $owner->first_name;
send_email($owner->id, 'owner', $email_data, $subject, 'userregister'); */
if ($owner->picture == NULL) {
$owner_picture = "";
} else {
$owner_picture = $owner->picture;
}
if ($owner->bio == NULL) {
$owner_bio = "";
} else {
$owner_bio = $owner->bio;
}
示例6: addUser
public function addUser()
{
// Create a new validator instance from our validation rules
$validator = Validator::make(Input::all(), $this->validationRules);
if ($validator->fails()) {
if ($validator->messages()->first('email')) {
$note = array('error' => true, 'message' => $validator->messages()->first('email'));
} else {
if ($validator->messages()->first('password')) {
$note = array('error' => true, 'message' => $validator->messages()->first('password'));
} else {
if ($validator->messages()->first('phone')) {
$note = array('error' => true, 'message' => $validator->messages()->first('phone'));
} else {
if ($validator->messages()->first('password_confirm')) {
$note = array('error' => true, 'message' => $validator->messages()->first('password_confirm'));
}
}
}
}
return $note;
//return Redirect::back()->withInput()->withErrors($validator);
} else {
// Get the inputs, with some exceptions
$inputs = Input::except('password_confirm', 'agent_id', 'group_id');
// Was the user created?
if ($user = Sentry::getUserProvider()->create($inputs)) {
$groupId = Input::get("group_id");
$group = Sentry::getGroupProvider()->findById($groupId);
$user->addGroup($group);
$mail = Input::get('email');
$getu_id = \User::where('email', $mail)->first();
$user_id = $getu_id->id;
$agent_id = Input::get("agent_id");
$getu_id->created_by = $agent_id;
$getu_id->created_by = $agent_id;
$getu_id->update();
$passwordlogin = Input::get('password');
$maillogin = Input::get('email');
$fname = Input::get('first_name');
$to = Input::get('phone');
if ($groupId == 3) {
$user->addGroup($group);
$tenant = new \Tenant();
$tenant->tenant_id = $user_id;
$tenant->agent_id = $agent_id;
$tenant->name = Input::get('first_name');
$tenant->lname = Input::get('last_name');
$tenant->phone = Input::get('phone');
$tenant->email = $mail;
$tenant->save();
$message = 'Hi ' . $fname . ' your tenant account on Mteja has been created successful.';
Queue::push('SendSMS', array('message' => $message, 'number' => $to));
$note2 = array('error' => false, 'message' => "Tenant Created Successfully");
return $note2;
} else {
if ($groupId == 1) {
$user->addGroup($group);
$owner = new \Owner();
$owner->owner_id = $user_id;
$owner->agent_id = $agent_id;
$owner->name = Input::get('first_name');
$owner->lname = Input::get('last_name');
$owner->phone = Input::get('phone');
$owner->activated = 0;
$owner->email = $mail;
$owner->save();
$codeAct = rand(100000, 999999);
$message = 'Hi ' . $fname . ' your Mteja account as an owner has been created successful.Activation code ' . $codeAct;
Queue::push('SendSMS', array('message' => $message, 'number' => $to));
$note3 = array('error' => false, 'message' => "Account Created Successfully You will be receiving an SMS with activation key shortly.");
return $note3;
}
}
} else {
$note4 = array('error' => true, 'message' => " Account not Created try again");
return $note4;
}
}
}
示例7: register
public function register()
{
$first_name = Input::get('first_name');
$last_name = Input::get('last_name');
$email = Input::get('email');
$phone = Input::get('phone');
$password = Input::get('password');
$picture = Input::file('picture');
$device_token = Input::get('device_token');
$device_type = Input::get('device_type');
$bio = Input::get('bio');
$address = Input::get('address');
$state = Input::get('state');
$country = Input::get('country');
$zipcode = Input::get('zipcode');
$login_by = Input::get('login_by');
$social_unique_id = Input::get('social_unique_id');
if ($password != "" and $social_unique_id == "") {
$validator = Validator::make(array('password' => $password, 'email' => $email, 'phone' => $phone, 'first_name' => $first_name, 'last_name' => $last_name, 'picture' => $picture, 'device_token' => $device_token, 'device_type' => $device_type, 'bio' => $bio, 'address' => $address, 'state' => $state, 'country' => $country, 'zipcode' => $zipcode, 'login_by' => $login_by), array('password' => 'required', 'email' => 'required|email', 'phone' => 'required', 'first_name' => 'required', 'last_name' => 'required', 'picture' => 'required|mimes:jpeg,bmp,png', 'device_token' => 'required', 'device_type' => 'required|in:android,ios', 'bio' => '', 'address' => '', 'state' => '', 'country' => '', 'zipcode' => 'integer', 'login_by' => 'required|in:manual,facebook,google'));
} elseif ($social_unique_id != "" and $password == "") {
$validator = Validator::make(array('email' => $email, 'phone' => $phone, 'first_name' => $first_name, 'last_name' => $last_name, 'picture' => $picture, 'device_token' => $device_token, 'device_type' => $device_type, 'bio' => $bio, 'address' => $address, 'state' => $state, 'country' => $country, 'zipcode' => $zipcode, 'login_by' => $login_by, 'social_unique_id' => $social_unique_id), array('email' => 'required|email', 'phone' => 'required', 'first_name' => 'required', 'last_name' => 'required', 'picture' => 'required|mimes:jpeg,bmp,png', 'device_token' => 'required', 'device_type' => 'required|in:android,ios', 'bio' => '', 'address' => '', 'state' => '', 'country' => '', 'zipcode' => 'integer', 'login_by' => 'required|in:manual,facebook,google', 'social_unique_id' => 'required|unique:owner'));
} elseif ($social_unique_id != "" and $password != "") {
$response_array = array('success' => false, 'error' => 'Invalid Input - either social_unique_id or password should be passed', 'error_code' => 401);
$response_code = 200;
goto response;
}
if ($validator->fails()) {
$error_messages = $validator->messages()->all();
Log::info('Error while during owner registration = ' . print_r($error_messages, true));
$response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
$response_code = 200;
} else {
if (Owner::where('email', '=', $email)->first()) {
$response_array = array('success' => false, 'error' => 'Email ID already Registred', 'error_code' => 402);
$response_code = 200;
} else {
$owner = new Owner();
$owner->first_name = $first_name;
$owner->last_name = $last_name;
$owner->email = $email;
$owner->phone = $phone;
if ($password != "") {
$owner->password = Hash::make($password);
}
$owner->token = generate_token();
$owner->token_expiry = generate_expiry();
// upload image
$file_name = time();
$file_name .= rand();
$file_name = sha1($file_name);
$ext = Input::file('picture')->getClientOriginalExtension();
Input::file('picture')->move(public_path() . "/uploads", $file_name . "." . $ext);
$local_url = $file_name . "." . $ext;
// Upload to S3
if (Config::get('app.s3_bucket') != "") {
$s3 = App::make('aws')->get('s3');
$pic = $s3->putObject(array('Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'SourceFile' => public_path() . "/uploads/" . $local_url));
$s3->putObjectAcl(array('Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'ACL' => 'public-read'));
$s3_url = $s3->getObjectUrl(Config::get('app.s3_bucket'), $file_name);
} else {
$s3_url = asset_url() . '/uploads/' . $local_url;
}
$owner->picture = $s3_url;
$owner->device_token = $device_token;
$owner->device_type = $device_type;
$owner->bio = $bio;
$owner->address = $address;
$owner->state = $state;
$owner->login_by = $login_by;
$owner->country = $country;
$owner->zipcode = $zipcode;
if ($social_unique_id != "") {
$owner->social_unique_id = $social_unique_id;
}
$owner->save();
// send email
$settings = Settings::where('key', 'email_owner_new_registration')->first();
$pattern = $settings->value;
$pattern = str_replace('%name%', $owner->first_name, $pattern);
$subject = "Welcome On Board";
email_notification($owner->id, 'owner', $pattern, $subject);
$response_array = array('success' => true, 'id' => $owner->id, 'first_name' => $owner->first_name, 'last_name' => $owner->last_name, 'phone' => $owner->phone, 'email' => $owner->email, 'picture' => $owner->picture, 'bio' => $owner->bio, 'address' => $owner->address, 'state' => $owner->state, 'country' => $owner->country, 'zipcode' => $owner->zipcode, 'login_by' => $owner->login_by, 'social_unique_id' => $owner->social_unique_id ? $owner->social_unique_id : "", 'device_token' => $owner->device_token, 'device_type' => $owner->device_type, 'token' => $owner->token);
$response_code = 200;
}
}
response:
$response = Response::json($response_array, $response_code);
return $response;
}
示例8: userSave
public function userSave()
{
$first_name = Input::get('first_name');
$last_name = Input::get('last_name');
$email = Input::get('email');
$phone = Input::get('phone');
$password = Input::get('password');
$referral_code = Input::get('referral_code');
$validator = Validator::make(array('first_name' => $first_name, 'last_name' => $last_name, 'email' => $email, 'password' => $password), array('password' => 'required', 'email' => 'required', 'last_name' => 'required', 'first_name' => 'required'));
$validator1 = Validator::make(array('email' => $email), array('email' => 'required|email'));
$validatorPhone = Validator::make(array('phone' => $phone), array('phone' => 'phone'));
if ($validator->fails()) {
$error_messages = $validator->messages()->first();
return Redirect::to('user/signup')->with('error', 'Please fill all the fields.');
} else {
if ($validator1->fails()) {
return Redirect::to('user/signup')->with('error', 'Please Enter email correctly.');
} else {
if ($validatorPhone->fails()) {
return Redirect::to('user/signup')->with('error', 'Invalid Phone Number Format');
} else {
if (Owner::where('email', $email)->count() == 0) {
$owner = new Owner();
$owner->first_name = $first_name;
$owner->last_name = $last_name;
$owner->email = $email;
if (Input::has('timezone')) {
$owner->timezone = Input::get('timezone');
}
$owner->phone = $phone;
if ($password != "") {
$owner->password = Hash::make($password);
}
$owner->token = generate_token();
$owner->token_expiry = generate_expiry();
$owner->save();
$zero_in_code = 10 - strlen($owner->id);
$referral_code1 = Config::get('app.referral_prefix');
for ($i = 0; $i < $zero_in_code; $i++) {
$referral_code1 .= "0";
}
$referral_code1 .= $owner->id;
/* Referral entry */
$ledger = new Ledger();
$ledger->owner_id = $owner->id;
$ledger->referral_code = $referral_code1;
$ledger->save();
if ($referral_code != "") {
if ($ledger = Ledger::where('referral_code', $referral_code)->first()) {
$referred_by = $ledger->owner_id;
/* $settings = Settings::where('key', 'default_referral_bonus')->first();
$referral_bonus = $settings->value;
$ledger = Ledger::find($ledger->id);
$ledger->total_referrals = $ledger->total_referrals + 1;
$ledger->amount_earned = $ledger->amount_earned + $referral_bonus;
$ledger->save(); */
$settings = Settings::where('key', 'default_referral_bonus_to_refered_user')->first();
$refered_user = $settings->value;
$settings = Settings::where('key', 'default_referral_bonus_to_refereel')->first();
$referral = $settings->value;
$ledger = Ledger::find($ledger->id);
$ledger->total_referrals = $ledger->total_referrals + 1;
$ledger->amount_earned = $ledger->amount_earned + $refered_user;
$ledger->save();
$ledger1 = Ledger::where('owner_id', $owner->id)->first();
$ledger1 = Ledger::find($ledger1->id);
$ledger1->amount_earned = $ledger1->amount_earned + $referral;
$ledger1->save();
$owner->referred_by = $ledger->owner_id;
$response_array = array('success' => true);
$response_code = 200;
}
}
$owner->save();
// ENVIA EMAIL ESTOU COM DIFICULDADE AQUI
//$settings = Settings::where('key', 'admin_email_address')->first();
//$admin_email = $settings->value;
//$pattern = array('admin_eamil' => $admin_email, 'name' => ucwords($owner->first_name . " " . $owner->last_name), 'web_url' => web_url());
//$subject = "Welcome to " . ucwords(Config::get('app.website_title')) . ", " . ucwords($owner->first_name . " " . $owner->last_name) . "";
//email_notification($owner->id, 'owner', $pattern, $subject, 'user_register', null);
return Redirect::to('user/signin')->with('success', 'You have successfully registered. <br>Please Login');
} else {
return Redirect::to('user/signup')->with('error', 'This email ID is already registered.');
}
}
}
}
}
示例9: postCreate
/**
* User create form processing.
*
* @return Redirect
*/
public function postCreate()
{
// Create a new validator instance from our validation rules
$validator = Validator::make(Input::all(), $this->validationRules);
// If validation fails, we'll exit the operation now.
if ($validator->fails()) {
// Ooops.. something went wrong
return Redirect::back()->withInput()->withErrors($validator);
}
try {
// We need to reverse the UI specific logic for our
// permissions here before we create the user.
$permissions = Input::get('permissions', array());
$this->decodePermissions($permissions);
app('request')->request->set('permissions', $permissions);
// Get the inputs, with some exceptions
$inputs = Input::except('csrf_token', 'password_confirm', 'groups');
// Was the user created?
if ($user = Sentry::getUserProvider()->create($inputs)) {
// Assign the selected groups to this user
foreach (Input::get('groups', array()) as $groupId) {
$group = Sentry::getGroupProvider()->findById($groupId);
$user->addGroup($group);
$mail = Input::get('email');
$getu_id = \User::where('email', $mail)->first();
$user_id = $getu_id->id;
$agent_id = Sentry::getUser()->id;
$getu_id->created_by = $agent_id;
$getu_id->update();
$passwordlogin = Input::get('password');
$maillogin = Input::get('email');
$fname = Input::get('first_name');
$to = Input::get('phone');
$message = ' Hi ' . $fname . ' Your Web ' . $group->name . ' username is ' . $maillogin . ' and the password: ' . $passwordlogin . '.To logon Visit mteja.co.ke ';
\LaravelAtApi::sendMessage($to, $message);
if ($groupId == 3) {
$user->addGroup($group);
$tenant = new \Tenant();
$tenant->tenant_id = $user_id;
$tenant->agent_id = $agent_id;
$tenant->name = Input::get('first_name');
$tenant->lname = Input::get('last_name');
$tenant->phone = Input::get('phone');
$tenant->email = $mail;
$tenant->save();
} else {
if ($groupId == 1) {
$user->addGroup($group);
$owner = new \Owner();
$owner->owner_id = $user_id;
$owner->agent_id = $agent_id;
$owner->name = Input::get('first_name');
$owner->lname = Input::get('last_name');
$owner->phone = Input::get('phone');
$owner->email = $mail;
$owner->save();
}
}
}
// Prepare the success message
$success = Lang::get('admin/users/message.success.create');
// Redirect to the new user page
return Redirect::route('admin.invoice.index', $user->id)->withFlashMessage($group->name . ' Created successfully');
}
// Prepare the error message
$error = Lang::get('admin/users/message.error.create');
// Redirect to the user creation page
return Redirect::route('create/user')->with('error', $error);
} catch (LoginRequiredException $e) {
$error = Lang::get('admin/users/message.user_login_required');
} catch (PasswordRequiredException $e) {
$error = Lang::get('admin/users/message.user_password_required');
} catch (UserExistsException $e) {
$error = Lang::get('admin/users/message.user_exists');
}
// Redirect to the user creation page
return Redirect::route('create/user')->withInput()->with('error', $error);
}