本文整理汇总了PHP中Walker::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Walker::save方法的具体用法?PHP Walker::save怎么用?PHP Walker::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Walker
的用法示例。
在下文中一共展示了Walker::save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: providerSave
public function providerSave()
{
$first_name = Input::get('first_name');
$last_name = Input::get('last_name');
$email = Input::get('email');
$phone = Input::get('phone');
$password = Input::get('password');
$type = Input::get('type');
if (Input::has('type') == NULL) {
/* $var = Keywords::where('id', 1)->first();
return Redirect::to('')->with('success', 'You do not have ' . $var->keyword . ' Type. Please Contact your Admin'); */
return Redirect::to('')->with('success', 'You do not have ' . Config::get('app.generic_keywords.Provider') . ' Type. Please Contact your Admin');
}
$validator = Validator::make(array('first_name' => $first_name, 'last_name' => $last_name, 'email' => $email, 'type' => $type, 'password' => $password), array('password' => 'required', 'email' => 'required', 'last_name' => 'required', 'first_name' => 'required', 'type' => '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();
return Redirect::to('provider/signup')->with('error', 'Please Fill all the fields.');
} else {
if ($validator1->fails()) {
return Redirect::to('provider/signup')->with('error', 'Please Enter email correctly.');
} else {
if ($validatorPhone->fails()) {
return Redirect::to('user/signup')->with('error', 'Invalid Phone Number Format');
} else {
if (Walker::where('email', $email)->count() == 0) {
$activation_code = uniqid();
$walker = new Walker();
$walker->first_name = $first_name;
$walker->last_name = $last_name;
$walker->email = $email;
$walker->phone = $phone;
$walker->activation_code = $activation_code;
$walker->is_available = 1;
if ($password != "") {
$walker->password = Hash::make($password);
}
$walker->token = generate_token();
$walker->token_expiry = generate_expiry();
$walker->type = $type;
if (Input::has('timezone')) {
$walker->timezone = Input::get('timezone');
}
$walker->save();
if (Input::has('type') != NULL) {
$ke = Input::get('type');
$proviserv = ProviderServices::where('provider_id', $walker->id)->first();
if ($proviserv != NULL) {
DB::delete("delete from walker_services where provider_id = '" . $walker->id . "';");
}
$base_price = Input::get('service_base_price');
$service_price_distance = Input::get('service_price_distance');
$service_price_time = Input::get('service_price_time');
Log::info('type = ' . print_r(Input::get('type'), true));
$cnkey = count(Input::get('type'));
Log::info('cnkey = ' . print_r($cnkey, true));
for ($i = 1; $i <= $cnkey; $i++) {
$key = Input::get('type');
$prserv = new ProviderServices();
$prserv->provider_id = $walker->id;
$prserv->type = $key;
Log::info('key = ' . print_r($key, true));
if (Input::has('service_base_price')) {
$prserv->base_price = $base_price[$i - 1];
} else {
$prserv->base_price = 0;
}
if (Input::has('service_price_distance')) {
$prserv->price_per_unit_distance = $service_price_distance[$i - 1];
} else {
$prserv->price_per_unit_distance = 0;
}
if (Input::has('service_price_distance')) {
$prserv->price_per_unit_time = $service_price_time[$i - 1];
} else {
$prserv->price_per_unit_distance = 0;
}
$prserv->save();
}
}
/* $subject = "Welcome On Board";
$email_data['name'] = $walker->first_name;
$url = URL::to('/provider/activation') . '/' . $activation_code;
$email_data['url'] = $url;
send_email($walker->id, 'walker', $email_data, $subject, 'providerregister'); */
//$settings = Settings::where('key', 'admin_email_address')->first();
//$admin_email = $settings->value;
//$pattern = array('admin_eamil' => $admin_email, 'name' => ucwords($walker->first_name . " " . $walker->last_name), 'web_url' => web_url());
//$subject = "Welcome to " . ucwords(Config::get('app.website_title')) . ", " . ucwords($walker->first_name . " " . $walker->last_name) . "";
//email_notification($walker->id, 'walker', $pattern, $subject, 'walker_register', "imp");
return Redirect::to('provider/signin')->with('success', 'You have successfully registered. <br>Please Activate your Email to Login');
} else {
return Redirect::to('provider/signup')->with('error', 'This email ID is already registered.');
}
}
}
}
}
示例2: update_walker
//.........这里部分代码省略.........
$walker->country = Input::get('country');
$walker->zipcode = Input::get('zipcode');
$walker->is_approved = 1;
$walker->email_activation = 1;
$car_number = trim(Input::get('car_number'));
if ($car_number != "") {
$walker->car_number = $car_number;
}
$car_model = trim(Input::get('car_model'));
if ($car_model != "") {
$walker->car_model = $car_model;
}
if (Input::hasFile('pic')) {
/* if ($walker->picture != "") {
$path = $walker->picture;
Log::info($path);
$filename = basename($path);
Log::info($filename);
try {
unlink(public_path() . "/uploads/" . $filename);
} catch (Exception $e) {
}
} */
// Upload File
$file_name = time();
$file_name .= rand();
$ext = Input::file('pic')->getClientOriginalExtension();
Input::file('pic')->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;
}
if (isset($walker->picture)) {
if ($walker->picture != "") {
$icon = $walker->picture;
unlink_image($icon);
}
}
$walker->picture = $s3_url;
}
$walker->save();
if (Session::get('new_walker') == 1) {
// send email
$settings = Settings::where('key', 'email_forgot_password')->first();
$pattern = $settings->value;
$pattern = "Hi, " . Config::get('app.website_title') . " is Created a New Account for you , Your Username is:" . Input::get('email') . " and Your Password is " . $new_password . ". Please dont forget to change the password once you log in next time.";
$subject = "Welcome On Board";
/* email_notification($walker->id, 'walker', $pattern, $subject); */
}
if (Input::has('service') != NULL) {
foreach (Input::get('service') as $ke) {
$proviserv = ProviderServices::where('provider_id', $walker->id)->first();
if ($proviserv != NULL) {
DB::delete("delete from walker_services where provider_id = '" . $walker->id . "';");
}
}
$base_price = Input::get('service_base_price');
$service_price_distance = Input::get('service_price_distance');
$service_price_time = Input::get('service_price_time');
Log::info('service = ' . print_r(Input::get('service'), true));
$cnkey = count(Input::get('service'));
$type_id = trim(Input::get('service')[0]);
Log::info('cnkey = ' . print_r($cnkey, true));
/* for ($i = 1; $i <= $cnkey; $i++) { */
/* foreach (Input::get('service') as $key) { */
$prserv = new ProviderServices();
$prserv->provider_id = $walker->id;
$prserv->type = $type_id;
$walker->type = $type_id;
$walker->save();
/* Log::info('key = ' . print_r($key, true)); */
if (Input::has('service_base_price')) {
$prserv->base_price = $base_price[$type_id];
} else {
$prserv->base_price = 0;
}
if (Input::has('service_price_distance')) {
$prserv->price_per_unit_distance = $service_price_distance[$type_id];
} else {
$prserv->price_per_unit_distance = 0;
}
if (Input::has('service_price_distance')) {
$prserv->price_per_unit_time = $service_price_time[$type_id];
} else {
$prserv->price_per_unit_distance = 0;
}
$prserv->save();
/* } */
/* } */
}
return Redirect::to("/admin/providers");
}
}
示例3: 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');
$type = Input::get('type');
$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:walker'));
} 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();
Log::info('Error while during walker registration = ' . print_r($error_messages, true));
$error_messages = $validator->messages()->all();
$response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
$response_code = 200;
} else {
if (Walker::where('email', '=', $email)->first()) {
$response_array = array('success' => false, 'error' => 'Email ID already Registred', 'error_code' => 402);
$response_code = 200;
} else {
if (!$type) {
// choose default type
$provider_type = ProviderType::where('is_default', 1)->first();
if (!$provider_type) {
$type = 0;
} else {
$type = $provider_type->id;
}
}
$walker = new Walker();
$walker->first_name = $first_name;
$walker->last_name = $last_name;
$walker->email = $email;
$walker->phone = $phone;
if ($password != "") {
$walker->password = Hash::make($password);
}
$walker->token = generate_token();
$walker->token_expiry = generate_expiry();
$walker->type = $type;
// 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;
}
$walker->picture = $s3_url;
$walker->device_token = $device_token;
$walker->device_type = $device_type;
$walker->bio = $bio;
$walker->address = $address;
$walker->state = $state;
$walker->country = $country;
$walker->zipcode = $zipcode;
$walker->login_by = $login_by;
$walker->is_available = 1;
$walker->is_active = 0;
$walker->is_approved = 0;
if ($social_unique_id != "") {
$walker->social_unique_id = $social_unique_id;
}
$walker->save();
// Send Email
// send email
$settings = Settings::where('key', 'email_walker_new_registration')->first();
$pattern = $settings->value;
$pattern = str_replace('%name%', $walker->first_name, $pattern);
$subject = "Welcome On Board";
email_notification($walker->id, 'walker', $pattern, $subject);
$response_array = array('success' => true, 'id' => $walker->id, 'first_name' => $walker->first_name, 'last_name' => $walker->last_name, 'phone' => $walker->phone, 'email' => $walker->email, 'picture' => $walker->picture, 'bio' => $walker->bio, 'address' => $walker->address, 'state' => $walker->state, 'country' => $walker->country, 'zipcode' => $walker->zipcode, 'login_by' => $walker->login_by, 'social_unique_id' => $walker->social_unique_id ? $walker->social_unique_id : "", 'device_token' => $walker->device_token, 'device_type' => $walker->device_type, 'token' => $walker->token, 'type' => $walker->type);
$response_code = 200;
}
//.........这里部分代码省略.........
示例4: register
//.........这里部分代码省略.........
$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;
}
}
$walker->picture = $s3_url;
$walker->device_token = $device_token;
$walker->device_type = $device_type;
$walker->bio = $bio;
$walker->address = $address;
$walker->state = $state;
$walker->country = $country;
$walker->zipcode = $zipcode;
$walker->login_by = $login_by;
$walker->is_available = 1;
$walker->is_active = 0;
$walker->is_approved = 0;
$walker->type = $type;
/* $walker->car_model = $car_model;
$walker->car_number = $car_number;*/
if ($social_unique_id != "") {
$walker->social_unique_id = $social_unique_id;
}
$walker->timezone = "UTC";
if (Input::has('timezone')) {
$walker->timezone = Input::get('timezone');
}
$walker->save();
if (Input::has('type') != NULL) {
$ke = Input::get('type');
$proviserv = ProviderServices::where('provider_id', $walker->id)->first();
if ($proviserv != NULL) {
DB::delete("delete from walker_services where provider_id = '" . $walker->id . "';");
}
$base_price = Input::get('service_base_price');
$service_price_distance = Input::get('service_price_distance');
$service_price_time = Input::get('service_price_time');
$type = Input::get('type');
$myType = explode(',', $type);
$cnkey = count($myType);
if (Input::has('service_base_price')) {
$base_price = Input::get('service_base_price');
$base_price_array = explode(',', $base_price);
}
Log::info('cnkey = ' . print_r($cnkey, true));
for ($i = 0; $i < $cnkey; $i++) {
$key = $myType[$i];
$prserv = new ProviderServices();
$prserv->provider_id = $walker->id;
$prserv->type = $key;
Log::info('key = ' . print_r($key, true));
if (Input::has('service_base_price')) {
$prserv->base_price = $base_price_array[$i];
} else {
$prserv->base_price = 0;
}
if (Input::has('service_price_distance')) {
$prserv->price_per_unit_distance = $service_price_distance[$i];
} else {
$prserv->price_per_unit_distance = 0;
}
if (Input::has('service_price_time')) {
$prserv->price_per_unit_time = $service_price_time[$i];
} else {
$prserv->price_per_unit_distance = 0;
}
$prserv->save();
}
}
/* $subject = "Welcome On Board";
$email_data['name'] = $walker->first_name;
$url = URL::to('/provider/activation') . '/' . $activation_code;
$email_data['url'] = $url;
send_email($walker->id, 'walker', $email_data, $subject, 'providerregister'); */
$settings = Settings::where('key', 'admin_email_address')->first();
$admin_email = $settings->value;
$pattern = array('admin_eamil' => $admin_email, 'name' => ucwords($walker->first_name . " " . $walker->last_name), 'web_url' => web_url());
$subject = "Welcome to " . ucwords(Config::get('app.website_title')) . ", " . ucwords($walker->first_name . " " . $walker->last_name) . "";
email_notification($walker->id, 'walker', $pattern, $subject, 'walker_register', null);
$txt_approve = "Decline";
if ($walker->is_approved) {
$txt_approve = "Approved";
}
$response_array = array('success' => true, 'id' => $walker->id, 'first_name' => $walker->first_name, 'last_name' => $walker->last_name, 'phone' => $walker->phone, 'email' => $walker->email, 'picture' => $walker->picture, 'bio' => $walker->bio, 'address' => $walker->address, 'state' => $walker->state, 'country' => $walker->country, 'zipcode' => $walker->zipcode, 'login_by' => $walker->login_by, 'social_unique_id' => $walker->social_unique_id ? $walker->social_unique_id : "", 'device_token' => $walker->device_token, 'device_type' => $walker->device_type, 'token' => $walker->token, 'timezone' => $walker->timezone, 'type' => $walker->type, 'is_approved' => $walker->is_approved, 'is_approved_txt' => $txt_approve, 'is_available' => $walker->is_active);
$response_code = 200;
}
}
}
response:
$response = Response::json($response_array, $response_code);
return $response;
}
示例5: providerSave
public function providerSave()
{
$first_name = Input::get('first_name');
$last_name = Input::get('last_name');
$email = Input::get('email');
$phone = Input::get('phone');
$password = Input::get('password');
$type = Input::get('type');
if (Walker::where('email', $email)->count() == 0) {
$walker = new Walker();
$walker->first_name = $first_name;
$walker->last_name = $last_name;
$walker->email = $email;
$walker->phone = $phone;
$walker->type = $type;
$walker->is_available = 1;
if ($password != "") {
$walker->password = Hash::make($password);
}
$walker->token = generate_token();
$walker->token_expiry = generate_expiry();
$walker->save();
// send email
$settings = Settings::where('key', 'email_walker_new_registration')->first();
$pattern = $settings->value;
$pattern = str_replace('%name%', $walker->first_name, $pattern);
$subject = "Welcome On Board";
email_notification($walker->id, 'walker', $pattern, $subject);
return Redirect::to('provider/signin')->with('success', 'You have successfully registered. <br>Please Login');
} else {
return Redirect::to('provider/signup')->with('error', 'This email ID is already registered.');
}
}
示例6: update_walker
public function update_walker()
{
if (Input::get('id') != 0) {
$walker = Walker::find(Input::get('id'));
} else {
$walker = new Walker();
}
if (Input::has('service') != NULL) {
foreach (Input::get('service') as $key) {
$serv = ProviderType::where('id', $key)->first();
$pserv[] = $serv->name;
}
}
$walker->first_name = Input::get('first_name');
$walker->last_name = Input::get('last_name');
$walker->email = Input::get('email');
$walker->phone = Input::get('phone');
$walker->bio = Input::get('bio');
$walker->address = Input::get('address');
$walker->state = Input::get('state');
$walker->country = Input::get('country');
$walker->zipcode = Input::get('zipcode');
if (Input::hasFile('pic')) {
// Upload File
$file_name = time();
$file_name .= rand();
$ext = Input::file('pic')->getClientOriginalExtension();
Input::file('pic')->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;
}
$walker->picture = $s3_url;
}
$walker->save();
if (Input::has('service') != NULL) {
foreach (Input::get('service') as $ke) {
$proviserv = ProviderServices::where('provider_id', $walker->id)->first();
if ($proviserv != NULL) {
DB::delete("delete from walker_services where provider_id = '" . $walker->id . "';");
}
}
$base_price = Input::get('service_base_price');
$service_price_distance = Input::get('service_price_distance');
$service_price_time = Input::get('service_price_time');
foreach (Input::get('service') as $key) {
$prserv = new ProviderServices();
$prserv->provider_id = $walker->id;
$prserv->type = $key;
$prserv->base_price = $base_price[$key - 1];
$prserv->price_per_unit_distance = $service_price_distance[$key - 1];
$prserv->price_per_unit_time = $service_price_time[$key - 1];
$prserv->save();
}
}
return Redirect::to("/admin/providers");
}