本文整理汇总了PHP中Walker::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Walker::where方法的具体用法?PHP Walker::where怎么用?PHP Walker::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Walker
的用法示例。
在下文中一共展示了Walker::where方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forgot_password
public function forgot_password()
{
$type = Input::get('type');
$email = Input::get('email');
if ($type == 1) {
// Walker
$walker_data = Walker::where('email', $email)->first();
if ($walker_data) {
$walker = Walker::find($walker_data->id);
$new_password = time();
$new_password .= rand();
$new_password = sha1($new_password);
$new_password = substr($new_password, 0, 8);
$walker->password = Hash::make($new_password);
$walker->save();
// send email
$settings = Settings::where('key', 'email_forgot_password')->first();
$pattern = $settings->value;
$pattern = str_replace('%password%', $new_password, $pattern);
$subject = "Your New Password";
email_notification($walker->id, 'walker', $pattern, $subject);
$response_array = array();
$response_array['success'] = true;
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
} else {
$response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
}
} else {
$owner_data = Owner::where('email', $email)->first();
if ($owner_data) {
$owner = Owner::find($owner_data->id);
$new_password = time();
$new_password .= rand();
$new_password = sha1($new_password);
$new_password = substr($new_password, 0, 8);
$owner->password = Hash::make($new_password);
$owner->save();
$settings = Settings::where('key', 'email_forgot_password')->first();
$pattern = $settings->value;
$pattern = str_replace('%password%', $new_password, $pattern);
$subject = "Your New Password";
email_notification($owner->id, 'owner', $pattern, $subject);
$response_array = array();
$response_array['success'] = true;
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
} else {
$response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
}
}
}
示例2: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$this->info('Working');
$date1 = date('Y-m-d h:i:s');
$this->info($date1);
$date = date_create($date1);
$msgtime = $date->add(new DateInterval('P0Y0M0DT0H30M0S'))->format('Y-m-d H:i:s');
$requests = Requests::where('later', 1)->where('is_started', 0)->where('request_start_time', '<=', $msgtime)->get();
if ($requests->count() > 0) {
$this->info('hola');
foreach ($requests as $request) {
$provider = Walker::where('id', $request->confirmed_walker)->first();
$owner = Owner::where('id', $request->owner_id)->first();
$message = "You have a ride scheduled in 30 mins from now. Client name is {$owner->first_name} {$owner->last_name} and phone no. is {$owner->phone}";
$this->info($request->id);
$this->info($message);
send_notifications($provider->id, 'provider', 'Ride in 30 min', $message);
$request->later = 0;
$request->save();
}
}
}
示例3: create_manual_request
public function create_manual_request()
{
$latitude = Input::get('latitude');
$longitude = Input::get('longitude');
$d_latitude = Input::get('d_latitude');
$d_longitude = Input::get('d_longitude');
$type = Input::get('type');
$provider = Input::get('provider');
$user_id = Session::get('user_id');
$time = date("Y-m-d H:i:s");
$provider_details = Walker::where('id', '=', $provider)->first();
$user = Owner::where('id', '=', $user_id)->first();
$request = new Requests();
$request->owner_id = $user_id;
$request->request_start_time = $time;
$request->confirmed_walker = $provider;
if ($d_longitude != '' && $d_latitude != '') {
$request->D_latitude = $d_latitude;
$request->D_longitude = $d_longitude;
}
$request->current_walker = $provider;
$request->status = 1;
$request->save();
$reqid = $request->id;
$request_service = new RequestServices();
$request_service->type = $type;
$request_service->request_id = $request->id;
$request_service->save();
$owner = Owner::find($user_id);
$owner->latitude = $latitude;
$owner->longitude = $longitude;
$owner->save();
$walkerlocation = new WalkLocation();
$walkerlocation->request_id = $request->id;
$walkerlocation->distance = 0.0;
$walkerlocation->latitude = $latitude;
$walkerlocation->longitude = $longitude;
$walkerlocation->save();
if ($request->save()) {
$current_request = Requests::where('id', '=', $reqid)->first();
return Redirect::to('/user/request-trip');
}
}
示例4: payment_type
public function payment_type()
{
$token = Input::get('token');
$owner_id = Input::get('id');
$request_id = Input::get('request_id');
$cash_or_card = Input::get('cash_or_card');
$validator = Validator::make(array('token' => $token, 'owner_id' => $owner_id, 'cash_or_card' => $cash_or_card, 'request_id' => $request_id), array('token' => 'required', 'owner_id' => 'required|integer', 'cash_or_card' => 'required', 'request_id' => 'required'));
if ($validator->fails()) {
$error_messages = $validator->messages()->all();
$response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
$response_code = 200;
} else {
$payments = array();
/* $payments['none'] = ""; */
$def_card = 0;
$is_admin = $this->isAdmin($token);
if ($owner_data = $this->getOwnerData($owner_id, $token, $is_admin)) {
// check for token validity
if (is_token_active($owner_data->token_expiry) || $is_admin) {
if ($cash_or_card != 1) {
$card_count = Payment::where('owner_id', '=', $owner_id)->count();
if ($card_count <= 0) {
$response_array = array('success' => false, 'error' => "Please add card first for payment.", 'error_code' => 417);
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
}
}
// Do necessary operations
$owner = Owner::find($owner_id);
$payment_data = Payment::where('owner_id', $owner_id)->orderBy('is_default', 'DESC')->get();
foreach ($payment_data as $data1) {
$default = $data1->is_default;
if ($default == 1) {
$def_card = $data1->id;
$data['is_default_text'] = "default";
} else {
$data['is_default_text'] = "not_default";
}
$data['id'] = $data1->id;
$data['owner_id'] = $data1->owner_id;
$data['customer_id'] = $data1->customer_id;
$data['last_four'] = $data1->last_four;
$data['card_token'] = $data1->card_token;
$data['card_type'] = $data1->card_type;
$data['card_id'] = $data1->card_token;
$data['is_default'] = $default;
array_push($payments, $data);
}
if ($request = Requests::find($request_id)) {
$request->payment_mode = $cash_or_card;
$request->save();
$walker = Walker::where('id', $request->confirmed_walker)->first();
if ($walker) {
$msg_array = array();
$msg_array['unique_id'] = 3;
$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, 'device_token' => $owner->device_token, 'device_type' => $owner->device_type, 'token' => $owner->token, 'default_card_id' => $def_card, 'payment_type' => $request->payment_mode, 'is_referee' => $owner->is_referee, 'promo_count' => $owner->promo_count, 'payments' => $payments);
$response_array['unique_id'] = 3;
$response_code = 200;
$msg_array['owner_data'] = $response_array;
$title = "Payment Type Change";
$message = $msg_array;
if ($request->confirmed_walker == $request->current_walker) {
send_notifications($request->confirmed_walker, "walker", $title, $message);
}
} else {
$response_array = array('success' => false, 'error' => 'Driver Not Found', 'error_code' => 408);
$response_code = 200;
}
} else {
$response_array = array('success' => false, 'error' => 'Request ID Not Found', 'error_code' => 408);
$response_code = 200;
}
} else {
$response_array = array('success' => false, 'error' => 'Token Expired', 'error_code' => 405);
$response_code = 200;
}
} else {
if ($is_admin) {
$response_array = array('success' => false, 'error' => 'Owner ID not Found', 'error_code' => 410);
} else {
$response_array = array('success' => false, 'error' => 'Not a valid token', 'error_code' => 406);
}
$response_code = 200;
}
}
$response = Response::json($response_array, $response_code);
return $response;
}
示例5: providerS_bankingSubmit
public function providerS_bankingSubmit()
{
$id = Input::get('id');
Log::info('id = ' . print_r($id, true));
Stripe::setApiKey(Config::get('app.stripe_secret_key'));
$token_id = Input::get('stripeToken');
Log::info('token_id = ' . print_r($token_id, true));
// Create a Recipient
try {
$recipient = Stripe_Recipient::create(array("name" => Input::get('first_name') . " " . Input::get('last_name'), "type" => Input::get('type'), "bank_account" => $token_id, "email" => Input::get('email')));
Log::info('recipient = ' . print_r($recipient, true));
$pro = Walker::where('id', Input::get('id'))->first();
$pro->merchant_id = $recipient->id;
$pro->account_id = $recipient->active_account->id;
$pro->last_4 = $recipient->active_account->last4;
$pro->save();
Log::info('recipient added = ' . print_r($recipient, true));
} catch (Exception $e) {
//Log::info('Error in Stripe = ' . print_r($e, true));
return Redirect::route("banking_provider_mobile", $id);
}
return Redirect::to("/");
}
示例6: respond_request
public function respond_request()
{
$token = Input::get('token');
$walker_id = Input::get('id');
$request_id = Input::get('request_id');
$accepted = Input::get('accepted');
$validator = Validator::make(array('token' => $token, 'walker_id' => $walker_id, 'request_id' => $request_id, 'accepted' => $accepted), array('token' => 'required', 'walker_id' => 'required|integer', 'accepted' => 'required|integer', 'request_id' => 'required|integer'));
if ($validator->fails()) {
$error_messages = $validator->messages()->all();
$response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
$response_code = 200;
} else {
$is_admin = $this->isAdmin($token);
if ($walker_data = $this->getWalkerData($walker_id, $token, $is_admin)) {
// check for token validity
if (is_token_active($walker_data->token_expiry) || $is_admin) {
// Retrive and validate the Request
if ($request = Requests::find($request_id)) {
if ($request->current_walker == $walker_id) {
if ($accepted == 1) {
// request ended
Requests::where('id', '=', $request_id)->update(array('confirmed_walker' => $walker_id, 'status' => 1, 'request_start_time' => date('Y-m-d H:i:s')));
// confirm walker
RequestMeta::where('request_id', '=', $request_id)->where('walker_id', '=', $walker_id)->update(array('status' => 1));
// Update Walker availability
Walker::where('id', '=', $walker_id)->update(array('is_available' => 0));
// remove other schedule_meta
RequestMeta::where('request_id', '=', $request_id)->where('status', '=', 0)->delete();
// Send Notification
$walker = Walker::find($walker_id);
$walker_data = array();
$walker_data['first_name'] = $walker->first_name;
$walker_data['last_name'] = $walker->last_name;
$walker_data['phone'] = $walker->phone;
$walker_data['bio'] = $walker->bio;
$walker_data['picture'] = $walker->picture;
$walker_data['latitude'] = $walker->latitude;
$walker_data['longitude'] = $walker->longitude;
$walker_data['rating'] = DB::table('review_walker')->where('walker_id', '=', $walker->id)->avg('rating') ?: 0;
$walker_data['num_rating'] = DB::table('review_walker')->where('walker_id', '=', $walker->id)->count();
$settings = Settings::where('key', 'default_distance_unit')->first();
$unit = $settings->value;
$bill = array();
if ($request->is_completed == 1) {
$bill['distance'] = convert($request->distance, $unit);
$bill['time'] = $request->time;
$bill['base_price'] = $request->base_price;
$bill['distance_cost'] = $request->distance_cost;
$bill['time_cost'] = $request->time_cost;
$bill['total'] = $request->total;
$bill['is_paid'] = $request->is_paid;
}
$response_array = array('success' => true, 'request_id' => $request_id, 'status' => $request->status, 'confirmed_walker' => $request->confirmed_walker, 'is_walker_started' => $request->is_walker_started, 'is_walker_arrived' => $request->is_walker_arrived, 'is_walk_started' => $request->is_started, 'is_completed' => $request->is_completed, 'is_walker_rated' => $request->is_walker_rated, 'walker' => $walker_data, 'bill' => $bill);
$title = "Walker Accepted";
$message = $response_array;
send_notifications($request->owner_id, "owner", $title, $message);
// Send SMS
$owner = Owner::find($request->owner_id);
$settings = Settings::where('key', 'sms_when_provider_accepts')->first();
$pattern = $settings->value;
$pattern = str_replace('%user%', $owner->first_name . " " . $owner->last_name, $pattern);
$pattern = str_replace('%driver%', $walker->first_name . " " . $walker->last_name, $pattern);
$pattern = str_replace('%Driver_mobile%', $walker->phone, $pattern);
sms_notification($request->owner_id, 'owner', $pattern);
// Send SMS
$settings = Settings::where('key', 'sms_request_completed')->first();
$pattern = $settings->value;
$pattern = str_replace('%user%', $owner->first_name . " " . $owner->last_name, $pattern);
$pattern = str_replace('%id%', $request->id, $pattern);
$pattern = str_replace('%user_mobile%', $owner->phone, $pattern);
sms_notification(1, 'admin', $pattern);
} else {
// Archiving Old Walker
RequestMeta::where('request_id', '=', $request_id)->where('walker_id', '=', $walker_id)->update(array('status' => 3));
$request_meta = RequestMeta::where('request_id', '=', $request_id)->where('status', '=', 0)->orderBy('created_at')->first();
// update request
if (isset($request_meta->walker_id)) {
// assign new walker
Requests::where('id', '=', $request_id)->update(array('current_walker' => $request_meta->walker_id, 'request_start_time' => date("Y-m-d H:i:s")));
// Send Notification
$walker = Walker::find($request_meta->walker_id);
$owner_data = Owner::find($request->owner_id);
$msg_array = array();
$msg_array['request_id'] = $request->id;
$msg_array['id'] = $request_meta->walker_id;
if ($walker) {
$msg_array['token'] = $walker->token;
}
$msg_array['client_profile'] = array();
$msg_array['client_profile']['name'] = $owner_data->first_name . " " . $owner_data->last_name;
$msg_array['client_profile']['picture'] = $owner_data->picture;
$msg_array['client_profile']['bio'] = $owner_data->bio;
$msg_array['client_profile']['address'] = $owner_data->address;
$msg_array['client_profile']['phone'] = $owner_data->phone;
$title = "New Request";
$message = $msg_array;
send_notifications($request_meta->walker_id, "walker", $title, $message);
} else {
// request ended
Requests::where('id', '=', $request_id)->update(array('current_walker' => 0, 'status' => 1));
//.........这里部分代码省略.........
示例7: check_banking
public function check_banking()
{
$token = Input::get('token');
$walker_id = Input::get('id');
$is_admin = $this->isAdmin($token);
if ($walker_data = $this->getWalkerData($walker_id, $token, $is_admin)) {
// check for token validity
if (is_token_active($walker_data->token_expiry) || $is_admin) {
// do
$default_banking = Config::get('app.default_payment');
$resp = array();
$resp['default_banking'] = $default_banking;
$walker = Walker::where('id', $walker_id)->first();
if ($walker->merchant_id != NULL) {
$resp['walker']['merchant_id'] = $walker->merchant_id;
}
$response_array = array('success' => true, 'details' => $resp);
$response_code = 200;
}
}
$response = Response::json($response_array, $response_code);
return $response;
}
示例8: get_request
public function get_request()
{
$request_id = Input::get('request_id');
$token = Input::get('token');
$owner_id = Input::get('id');
$validator = Validator::make(array('request_id' => $request_id, 'token' => $token, 'owner_id' => $owner_id), array('request_id' => 'required|integer', 'token' => 'required', 'owner_id' => 'required|integer'));
/* $var = Keywords::where('id', 2)->first(); */
if ($validator->fails()) {
$error_messages = $validator->messages()->all();
$response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
$response_code = 200;
} else {
$is_admin = $this->isAdmin($token);
if ($owner_data = $this->getOwnerData($owner_id, $token, $is_admin)) {
// check for token validity
if (is_token_active($owner_data->token_expiry) || $is_admin) {
/* SEND REFERRAL & PROMO INFO */
$settings = Settings::where('key', 'referral_code_activation')->first();
$referral_code_activation = $settings->value;
if ($referral_code_activation) {
$referral_code_activation_txt = "referral on";
} else {
$referral_code_activation_txt = "referral off";
}
$settings = Settings::where('key', 'promotional_code_activation')->first();
$promotional_code_activation = $settings->value;
if ($promotional_code_activation) {
$promotional_code_activation_txt = "promo on";
} else {
$promotional_code_activation_txt = "promo off";
}
/* SEND REFERRAL & PROMO INFO */
// Do necessary operations
if ($request = Requests::find($request_id)) {
if ($request->owner_id == $owner_data->id) {
if ($request->current_walker != 0) {
if ($request->confirmed_walker != 0) {
$walker = Walker::where('id', $request->confirmed_walker)->first();
$walker_data = array();
$walker_data['unique_id'] = 1;
$walker_data['id'] = $walker->id;
$walker_data['first_name'] = $walker->first_name;
$walker_data['last_name'] = $walker->last_name;
$walker_data['phone'] = $walker->phone;
$walker_data['bio'] = $walker->bio;
$walker_data['picture'] = $walker->picture;
$walker_data['latitude'] = $walker->latitude;
$walker_data['longitude'] = $walker->longitude;
if ($request->D_latitude != NULL) {
$walker_data['d_latitude'] = $request->D_latitude;
$walker_data['d_longitude'] = $request->D_longitude;
}
$walker_data['type'] = $walker->type;
$walker_data['rating'] = $walker->rate;
$walker_data['num_rating'] = $walker->rate_count;
$walker_data['car_model'] = $walker->car_model;
$walker_data['car_number'] = $walker->car_number;
$walker_data['bearing'] = $walker->bearing;
/* $walker_data['rating'] = DB::table('review_walker')->where('walker_id', '=', $walker->id)->avg('rating') ? : 0;
$walker_data['num_rating'] = DB::table('review_walker')->where('walker_id', '=', $walker->id)->count(); */
$settings = Settings::where('key', 'default_distance_unit')->first();
$unit = $settings->value;
if ($unit == 0) {
$unit_set = 'kms';
} elseif ($unit == 1) {
$unit_set = 'miles';
}
$requestserv = RequestServices::where('request_id', $request->id)->first();
$bill = array();
$request_typ = ProviderType::where('id', '=', $requestserv->type)->first();
/* $currency_selected = Keywords::find(5);
$cur_symb = $currency_selected->keyword; */
$cur_symb = Config::get('app.generic_keywords.Currency');
if ($request->is_completed == 1) {
$bill['unit'] = $unit_set;
$bill['payment_mode'] = $request->payment_mode;
$bill['distance'] = (string) $request->distance;
$bill['time'] = $request->time;
if ($requestserv->base_price != 0) {
$bill['base_distance'] = $request_typ->base_distance;
$bill['base_price'] = currency_converted($requestserv->base_price);
$bill['distance_cost'] = currency_converted($requestserv->distance_cost);
$bill['time_cost'] = currency_converted($requestserv->time_cost);
} else {
/* $setbase_price = Settings::where('key', 'base_price')->first();
$bill['base_price'] = currency_converted($setbase_price->value);
$setdistance_price = Settings::where('key', 'price_per_unit_distance')->first();
$bill['distance_cost'] = currency_converted($setdistance_price->value);
$settime_price = Settings::where('key', 'price_per_unit_time')->first();
$bill['time_cost'] = currency_converted($settime_price->value); */
$bill['base_distance'] = $request_typ->base_distance;
$bill['base_price'] = currency_converted($request_typ->base_price);
$bill['distance_cost'] = currency_converted($request_typ->price_per_unit_distance);
$bill['time_cost'] = currency_converted($request_typ->price_per_unit_time);
}
if ($request->payment_mode == 2) {
$bill['walker']['email'] = $walker->email;
$bill['walker']['amount'] = currency_converted($request->transfer_amount);
$admins = Admin::first();
$bill['admin']['email'] = $admins->username;
//.........这里部分代码省略.........
示例9: forgot_password
public function forgot_password()
{
$type = Input::get('type');
$email = Input::get('email');
if ($type == 1) {
// Walker
$walker_data = Walker::where('email', $email)->first();
if ($walker_data) {
$walker = Walker::find($walker_data->id);
$new_password = time();
$new_password .= rand();
$new_password = sha1($new_password);
$new_password = substr($new_password, 0, 8);
$walker->password = Hash::make($new_password);
$walker->save();
/* $subject = "Your New Password";
$email_data = array();
$email_data['password'] = $new_password;
send_email($walker->id, 'walker', $email_data, $subject, 'forgotpassword'); */
$settings = Settings::where('key', 'admin_email_address')->first();
$admin_email = $settings->value;
$login_url = web_url() . "/provider/signin";
$pattern = array('name' => $walker->first_name . " " . $walker->last_name, 'admin_eamil' => $admin_email, 'new_password' => $new_password, 'login_url' => $login_url);
$subject = "Your New Password";
email_notification($walker->id, 'walker', $pattern, $subject, 'forgot_password', "imp");
$response_array = array();
$response_array['success'] = true;
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
} else {
$response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
}
} else {
$owner_data = Owner::where('email', $email)->first();
if ($owner_data) {
$owner = Owner::find($owner_data->id);
$new_password = time();
$new_password .= rand();
$new_password = sha1($new_password);
$new_password = substr($new_password, 0, 8);
$owner->password = Hash::make($new_password);
$owner->save();
/* $subject = "Your New Password";
$email_data = array();
$email_data['password'] = $new_password;
send_email($owner->id, 'owner', $email_data, $subject, 'forgotpassword'); */
$settings = Settings::where('key', 'admin_email_address')->first();
$admin_email = $settings->value;
$login_url = web_url() . "/user/signin";
$pattern = array('name' => $owner->first_name . " " . $owner->last_name, 'admin_eamil' => $admin_email, 'new_password' => $new_password, 'login_url' => $login_url);
$subject = "Your New Password";
email_notification($owner->id, 'owner', $pattern, $subject, 'forgot_password', "imp");
$response_array = array();
$response_array['success'] = true;
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
} else {
$response_array = array('success' => false, 'error' => 'This Email is not Registered', 'error_code' => 425);
$response_code = 200;
$response = Response::json($response_array, $response_code);
return $response;
}
}
}
示例10: paybypalwebSubmit
public function paybypalwebSubmit()
{
// Normal Payment
$request_id = Request::segment(3);
$request = Requests::where('id', $request_id)->first();
$reqserv = RequestServices::where('request_id', $request_id)->first();
$typess = ProviderType::where('id', $reqserv->type)->first();
$total_amount = $request->total;
$service_name = $typess->name;
$owner = Owner::where('id', $request->owner_id)->first();
$walker = Walker::where('id', $request->confirmed_walker)->first();
$admins = Admin::first();
// Adaptive payments
// check if transfer is allowed
$transfersett = Settings::where('key', 'transfer')->first();
$payRequest = new PayRequest();
if ($transfersett->value == 1) {
$receiver = array();
$receiver[0] = new Receiver();
$receiver[0]->amount = $request->total - $request->transfer_amount;
// $receiver[0]->email = "testpaypal34@gmail.com";
$receiver[0]->email = $admins->username;
$receiver[0]->primary = "true";
$receiver[1] = new Receiver();
$receiver[1]->amount = $request->transfer_amount;
// $receiver[1]->email = "joydhanbad@gmail.com";
$receiver[1]->email = $walker->email;
} else {
$receiver = array();
$receiver[0] = new Receiver();
$receiver[0]->amount = $request->total;
// $receiver[0]->email = "testpaypal34@gmail.com";
$receiver[0]->email = $admins->username;
$receiver[0]->primary = "true";
}
$receiverList = new ReceiverList($receiver);
$payRequest->receiverList = $receiverList;
$requestEnvelope = new RequestEnvelope("en_US");
$payRequest->requestEnvelope = $requestEnvelope;
$payRequest->actionType = "PAY";
$payRequest->cancelUrl = URL::route('userpaypalstatus');
$payRequest->returnUrl = URL::route('userpaypalstatus');
$payRequest->currencyCode = "USD";
$payRequest->ipnNotificationUrl = URL::route('userpaypalipn');
$sdkConfig = array("mode" => Config::get('app.paypal_sdk_mode'), "acct1.UserName" => Config::get('app.paypal_sdk_UserName'), "acct1.Password" => Config::get('app.paypal_sdk_Password'), "acct1.Signature" => Config::get('app.paypal_sdk_Signature'), "acct1.AppId" => Config::get('app.paypal_sdk_AppId'));
$adaptivePaymentsService = new AdaptivePaymentsService($sdkConfig);
$payResponse = $adaptivePaymentsService->Pay($payRequest);
Log::info('payResponse = ' . print_r($payResponse, true));
return Redirect::to('userpaypalstatus');
}
示例11:
User
</p>
</div>
<div class="icon">
<i class="ion ion-person-add"></i>
</div>
</div>
</div><!-- ./col -->
<div class="col-lg-6 col-xs-6">
<!-- small box -->
<div class="small-box bg-yellow">
<div class="inner">
<h3>
<?php
$walker = Walker::where('id', $request->confirmed_walker)->first();
if ($walker != NULL) {
echo $walker->first_name . ' ' . $walker->last_name;
}
?>
</h3>
<p>
Providers
</p>
</div>
<div class="icon">
<i class="ion ion-person"></i>
</div>
</div>
</div><!-- ./col -->
示例12: approve_request
public function approve_request()
{
$request_id = Request::segment(4);
$walker_id = Session::get('walker_id');
$request = Requests::find($request_id);
if ($request->current_walker == $walker_id) {
// request ended
Requests::where('id', '=', $request_id)->update(array('confirmed_walker' => $walker_id, 'status' => 1, 'request_start_time' => date('Y-m-d H:i:s')));
// confirm walker
RequestMeta::where('request_id', '=', $request_id)->where('walker_id', '=', $walker_id)->update(array('status' => 1));
// Update Walker availability
Walker::where('id', '=', $walker_id)->update(array('is_available' => 0));
// remove other schedule_meta
RequestMeta::where('request_id', '=', $request_id)->where('status', '=', 0)->delete();
// Send Notification
$walker = Walker::find($walker_id);
$walker_data = array();
$walker_data['first_name'] = $walker->first_name;
$walker_data['last_name'] = $walker->last_name;
$walker_data['phone'] = $walker->phone;
$walker_data['bio'] = $walker->bio;
$walker_data['picture'] = $walker->picture;
$walker_data['latitude'] = $walker->latitude;
$walker_data['longitude'] = $walker->longitude;
$walker_data['rating'] = DB::table('review_walker')->where('walker_id', '=', $walker->id)->avg('rating') ?: 0;
$walker_data['num_rating'] = DB::table('review_walker')->where('walker_id', '=', $walker->id)->count();
$settings = Settings::where('key', 'default_distance_unit')->first();
$unit = $settings->value;
$bill = array();
if ($request->is_completed == 1) {
$bill['distance'] = convert($request->distance, $unit);
$bill['time'] = $request->time;
$bill['base_price'] = $request->base_price;
$bill['distance_cost'] = $request->distance_cost;
$bill['time_cost'] = $request->time_cost;
$bill['total'] = $request->total;
$bill['is_paid'] = $request->is_paid;
}
$response_array = array('success' => true, 'request_id' => $request_id, 'status' => $request->status, 'confirmed_walker' => $request->confirmed_walker, 'is_walker_started' => $request->is_walker_started, 'is_walker_arrived' => $request->is_walker_arrived, 'is_walk_started' => $request->is_started, 'is_completed' => $request->is_completed, 'is_walker_rated' => $request->is_walker_rated, 'walker' => $walker_data, 'bill' => $bill);
$title = "Walker Accepted";
$message = $response_array;
send_notifications($request->owner_id, "owner", $title, $message);
// Send SMS
$owner = Owner::find($request->owner_id);
$settings = Settings::where('key', 'sms_when_provider_accepts')->first();
$pattern = $settings->value;
$pattern = str_replace('%user%', $owner->first_name . " " . $owner->last_name, $pattern);
$pattern = str_replace('%driver%', $walker->first_name . " " . $walker->last_name, $pattern);
$pattern = str_replace('%Driver_mobile%', $walker->phone, $pattern);
sms_notification($request->owner_id, 'owner', $pattern);
// Send SMS
$settings = Settings::where('key', 'sms_request_completed')->first();
$pattern = $settings->value;
$pattern = str_replace('%user%', $owner->first_name . " " . $owner->last_name, $pattern);
$pattern = str_replace('%id%', $request->id, $pattern);
$pattern = str_replace('%user_mobile%', $owner->phone, $pattern);
sms_notification(1, 'admin', $pattern);
}
return Redirect::to('/provider/tripinprogress');
}
示例13: availability_provider
public function availability_provider()
{
$id = Request::segment(4);
$provider = Walker::where('id', $id)->first();
if ($provider) {
$success = Input::get('success');
$pavail = ProviderAvail::where('provider_id', $id)->paginate(10);
$prvi = array();
foreach ($pavail as $pv) {
$prv = array();
$prv['title'] = 'available';
$prv['start'] = date('Y-m-d', strtotime($pv->start)) . "T" . date('H:i:s', strtotime($pv->start));
$prv['end'] = date('Y-m-d', strtotime($pv->end)) . "T" . date('H:i:s', strtotime($pv->end));
array_push($prvi, $prv);
}
$pvjson = json_encode($prvi);
Log::info('Provider availability json = ' . print_r($pvjson, true));
return View::make('availability_provider')->with('title', 'Provider Availability')->with('page', 'availability_provider')->with('success', $success)->with('pvjson', $pvjson)->with('provider', $provider);
} else {
return View::make('admin.notfound')->with('title', 'Error Page Not Found')->with('page', 'Error Page Not Found');
}
}