本文整理匯總了PHP中Owner::where方法的典型用法代碼示例。如果您正苦於以下問題:PHP Owner::where方法的具體用法?PHP Owner::where怎麽用?PHP Owner::where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Owner
的用法示例。
在下文中一共展示了Owner::where方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create
/**
* Show the form for creating a new resource.
* GET /properties/create
*
* @return Response
*/
public function create()
{
$properties = Owner::where('agent_id', '=', Sentry::getUser()->id)->get();
if (!$properties->isEmpty()) {
return View::make('backend.code.property.create', compact('properties'));
} else {
return Redirect::action('Controllers\\Admin\\UsersController@getCreate')->withFlashMessage('You need to create an Owner first before you Proceed');
}
}
示例2: getOwnerData
public function getOwnerData($owner_id, $token, $is_admin)
{
if ($owner_data = Owner::where('token', '=', $token)->where('id', '=', $owner_id)->first()) {
return $owner_data;
} elseif ($is_admin) {
$owner_data = Owner::where('id', '=', $owner_id)->first();
if (!$owner_data) {
return false;
}
return $owner_data;
} else {
return false;
}
}
示例3: 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();
}
}
}
示例4: edit
/**
* Show the form for editing the specified resource.
* GET /properties/{id}/edit
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$properties = Property::find($id);
$owners = Owner::where('agent_id', '=', Sentry::getUser()->id)->get();
$deposits = Receivable::where('receivable_type', '=', 'deposit')->get();
$others = Receivable::where('receivable_type', '=', 'recurrent')->get();
if (is_null($properties)) {
return Redirect::route('admin.property.index');
}
return View::make('backend.code.property.edit', compact('properties', 'owners', 'deposits', 'others'));
}
示例5: 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');
}
}
示例6: index
/**
* Display a listing of the resource.
* GET /owners
*
* @return Response
*/
public function index()
{
$agent_id = Sentry::getUser()->id;
$owners = Owner::where('agent_id', $agent_id)->get();
return View::make('backend.code.owner.index', compact('owners'));
}
示例7: send_eta
public function send_eta()
{
$token = Input::get('token');
$owner_id = Input::get('id');
$phones = Input::get('phone');
$request_id = Input::get('request_id');
$eta = Input::get('eta');
$validator = Validator::make(array('token' => $token, 'owner_id' => $owner_id, 'phones' => $phones, 'eta' => $eta), array('token' => 'required', 'phones' => 'required', 'owner_id' => 'required|integer', 'eta' => '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 {
$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 phones is not an array
if (!is_array($phones)) {
$phones = explode(',', $phones);
}
Log::info('phones = ' . print_r($phones, true));
foreach ($phones as $key) {
$owner = Owner::where('id', $owner_id)->first();
$secret = str_random(6);
$request = Requests::where('id', $request_id)->first();
$request->security_key = $secret;
$request->save();
$msg = $owner->first_name . ' ' . $owner->last_name . ' ETA : ' . $eta;
send_eta($key, $msg);
Log::info('Send ETA MSG = ' . print_r($msg, true));
}
$response_array = array('success' => true);
$response_code = 200;
} else {
$response_array = array('success' => false, 'error' => 'Token Expired', 'error_code' => 405);
$response_code = 200;
}
} else {
if ($is_admin) {
/* $var = Keywords::where('id', 2)->first();
$response_array = array('success' => false, 'error' => '' . $var->keyword . ' ID not Found', 'error_code' => 410); */
$response_array = array('success' => false, 'error' => '' . Config::get('app.generic_keywords.User') . ' 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;
}
示例8: get_track_loc
public function get_track_loc($id)
{
$request = Requests::where('security_key', $id)->where('is_started', 1)->where('is_completed', 0)->first();
if ($request) {
$owner = Owner::where('id', $request->owner_id)->first();
$user_name = $owner->first_name . " " . $owner->last_name;
$theme = Theme::all();
$logo = '/image/logo.png';
$favicon = '/image/favicon.ico';
foreach ($theme as $themes) {
$favicon = '/uploads/' . $themes->favicon;
$logo = '/uploads/' . $themes->logo;
}
if ($logo == '/uploads/') {
$logo = '/image/logo.png';
}
if ($favicon == '/uploads/') {
$favicon = '/image/favicon.ico';
}
$app_name = Config::get('app.website_title');
// walk location
$start_loc = WalkLocation::where('request_id', $request->id)->first();
$reqloc = WalkLocation::where('request_id', $request->id)->orderBy('id', 'desc')->first();
$title = 'Track ' . $user_name;
return Response::json(array('success' => true, 'titl' => $title, 'logo' => $logo, 'favicon' => $favicon, 'app_name' => $app_name, 'cur_lat' => $reqloc->latitude, 'cur_lon' => $reqloc->longitude, 'prev_lat' => $start_loc->latitude, 'prev_lon' => $start_loc->longitude, 'track_id' => $id));
} else {
return Redirect::to('/');
}
}
示例9: request_walk_completed_old123
public function request_walk_completed_old123()
{
if (Request::isMethod('post')) {
$request_id = Input::get('request_id');
$token = Input::get('token');
$walker_id = Input::get('id');
$latitude = Input::get('latitude');
$longitude = Input::get('longitude');
$distance = Input::get('distance');
$time = Input::get('time');
if (Input::has('bearing')) {
$angle = Input::get('bearing');
}
Log::info('distance input = ' . print_r($distance, true));
Log::info('time input = ' . print_r($time, true));
$validator = Validator::make(array('request_id' => $request_id, 'token' => $token, 'walker_id' => $walker_id, 'latitude' => $latitude, 'longitude' => $longitude, 'distance' => $distance), array('request_id' => 'required|integer', 'token' => 'required', 'walker_id' => 'required|integer', 'latitude' => 'required', 'longitude' => 'required', 'distance' => '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 {
$cash_card_user = "";
$payment_type = "";
$walker_payment_remaining = 0;
$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) {
$providertype = ProviderType::where('id', $walker_data->type)->first();
// Do necessary operations
if ($request = Requests::find($request_id)) {
$time = $request->time;
if ($request->confirmed_walker == $walker_id) {
if ($request->is_started == 1) {
$settings = Settings::where('key', 'default_charging_method_for_users')->first();
$pricing_type = $settings->value;
$settings = Settings::where('key', 'default_distance_unit')->first();
$unit = $settings->value;
Log::info('distance = ' . print_r($distance, true));
$reqserv = RequestServices::where('request_id', $request_id)->get();
$actual_total = 0;
$price_per_unit_distance = 0;
$price_per_unit_time = 0;
$base_price = 0;
foreach ($reqserv as $rse) {
Log::info('type = ' . print_r($rse->type, true));
$protype = ProviderType::where('id', $rse->type)->first();
$pt = ProviderServices::where('provider_id', $walker_id)->where('type', $rse->type)->first();
if ($pt->base_price == 0) {
/* $setbase_price = Settings::where('key', 'base_price')->first();
$base_price = $setbase_price->value; */
$base_price = $providertype->base_price;
$rse->base_price = $base_price;
} else {
$base_price = $pt->base_price;
$rse->base_price = $base_price;
}
$is_multiple_service = Settings::where('key', 'allow_multiple_service')->first();
if ($is_multiple_service->value == 0) {
if ($pt->price_per_unit_distance == 0) {
/* $setdistance_price = Settings::where('key', 'price_per_unit_distance')->first();
$price_per_unit_distance = $setdistance_price->value * $distance;
$rse->distance_cost = $price_per_unit_distance; */
if ($distance <= $providertype->base_distance) {
$price_per_unit_distance = 0;
} else {
$price_per_unit_distance = $providertype->price_per_unit_distance * ($distance - $providertype->base_distance);
}
$rse->distance_cost = $price_per_unit_distance;
} else {
if ($distance <= $providertype->base_distance) {
$price_per_unit_distance = 0;
} else {
$price_per_unit_distance = $pt->price_per_unit_distance * ($distance - $providertype->base_distance);
}
$rse->distance_cost = $price_per_unit_distance;
}
if ($pt->price_per_unit_time == 0) {
/* $settime_price = Settings::where('key', 'price_per_unit_time')->first();
$price_per_unit_time = $settime_price->value * $time; */
$price_per_unit_time = $providertype->price_per_unit_time * $time;
$rse->time_cost = $price_per_unit_time;
} else {
$price_per_unit_time = $pt->price_per_unit_time * $time;
$rse->time_cost = $price_per_unit_time;
}
}
Log::info('total price = ' . print_r($base_price + $price_per_unit_distance + $price_per_unit_time, true));
$rse->total = $base_price + $price_per_unit_distance + $price_per_unit_time;
$rse->save();
$actual_total = $actual_total + $base_price + $price_per_unit_distance + $price_per_unit_time;
Log::info('total_price = ' . print_r($actual_total, true));
}
pay_fail:
$rs = RequestServices::where('request_id', $request_id)->get();
$total = 0;
foreach ($rs as $key) {
Log::info('total = ' . print_r($key->total, true));
$total = $total + $key->total;
}
//.........這裏部分代碼省略.........
示例10: schedule_request
public function schedule_request()
{
/* Cronjob counter */
/* echo asset_url() . "/cron_count.txt"; */
$css_msg = file(asset_url() . "/cron_count.txt");
if ($css_msg[0] > '1000') {
$css_msg[0] = 0;
} else {
$css_msg[0]++;
}
/* echo $css_msg[0]; */
$t = file_put_contents(public_path() . '/cron_count.txt', $css_msg[0]);
$css_msg[0];
/* Cronjob counter END */
$time = date("Y-m-d H:i:s");
$timezone_app = Config::get('app.timezone');
date_default_timezone_set($timezone_app);
$timezone_sys = date_default_timezone_get();
$query = "SELECT request.*,TIMESTAMPDIFF(SECOND,request_start_time, '{$time}') as diff from request where status = 0 and is_cancelled = 0";
$results = DB::select(DB::raw($query));
/* 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 */
$driver_data = "";
foreach ($results as $result) {
$settings = Settings::where('key', 'provider_timeout')->first();
$timeout = $settings->value;
if ($result->diff >= $timeout) {
// Archiving Old Walker
RequestMeta::where('request_id', '=', $result->id)->where('walker_id', '=', $result->current_walker)->update(array('status' => 2));
$request = Requests::where('id', $result->id)->first();
$request_meta = RequestMeta::where('request_id', '=', $result->id)->where('status', '=', 0)->orderBy('created_at')->first();
// update request
if (isset($request_meta->walker_id)) {
// assign new walker
Requests::where('id', '=', $result->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);
$settings = Settings::where('key', 'provider_timeout')->first();
$time_left = $settings->value;
$owner = Owner::find($result->owner_id);
$msg_array = array();
$msg_array['unique_id'] = 1;
$msg_array['request_id'] = $request->id;
$msg_array['time_left_to_respond'] = $time_left;
$msg_array['payment_mode'] = $request->payment_mode;
$msg_array['client_profile'] = array();
$msg_array['client_profile']['name'] = $owner->first_name . " " . $owner->last_name;
$msg_array['client_profile']['picture'] = $owner->picture;
$msg_array['client_profile']['bio'] = $owner->bio;
$msg_array['client_profile']['address'] = $owner->address;
$msg_array['client_profile']['phone'] = $owner->phone;
$owner = Owner::find($result->owner_id);
$request_data = array();
$request_data['owner'] = array();
$request_data['owner']['name'] = $owner->first_name . " " . $owner->last_name;
$request_data['owner']['picture'] = $owner->picture;
$request_data['owner']['phone'] = $owner->phone;
$request_data['owner']['address'] = $owner->address;
$request_data['owner']['latitude'] = $owner->latitude;
$request_data['owner']['longitude'] = $owner->longitude;
if ($request->d_latitude != NULL) {
$request_data['owner']['d_latitude'] = $request->D_latitude;
$request_data['owner']['d_longitude'] = $request->D_longitude;
}
$request_data['owner']['rating'] = $owner->rate;
$request_data['owner']['num_rating'] = $owner->rate_count;
/* $request_data['owner']['rating'] = DB::table('review_dog')->where('owner_id', '=', $owner->id)->avg('rating') ? : 0;
$request_data['owner']['num_rating'] = DB::table('review_dog')->where('owner_id', '=', $owner->id)->count(); */
$msg_array['request_data'] = $request_data;
$title = "New Request";
$message = $msg_array;
Log::info('New Request = ' . print_r($message, true));
send_notifications($request_meta->walker_id, "walker", $title, $message);
$driver_data = array();
$driver_data['unique_id'] = 1;
$driver_data['id'] = "" . $walker->id;
$driver_data['first_name'] = "" . $walker->first_name;
$driver_data['last_name'] = "" . $walker->last_name;
$driver_data['phone'] = "" . $walker->phone;
/* $driver_data['email'] = "" . $walker->email; */
$driver_data['picture'] = "" . $walker->picture;
$driver_data['bio'] = "" . $walker->bio;
/* $driver_data['address'] = "" . $walker->address;
$driver_data['state'] = "" . $walker->state;
$driver_data['country'] = "" . $walker->country;
$driver_data['zipcode'] = "" . $walker->zipcode;
//.........這裏部分代碼省略.........
示例11: 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;
}
}
}
示例12: 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;
}
}
}
示例13: login
public function login()
{
$login_by = Input::get('login_by');
$device_token = Input::get('device_token');
$device_type = Input::get('device_type');
if (Input::has('email') && Input::has('password')) {
$email = Input::get('email');
$password = Input::get('password');
$validator = Validator::make(array('password' => $password, 'email' => $email, 'device_token' => $device_token, 'device_type' => $device_type, 'login_by' => $login_by), array('password' => 'required', 'email' => 'required|email', 'device_token' => 'required', 'device_type' => 'required|in:android,ios', 'login_by' => 'required|in:manual,facebook,google'));
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;
Log::error('Validation error during manual login for owner = ' . print_r($error_messages, true));
} else {
if ($owner = Owner::where('email', '=', $email)->first()) {
if (Hash::check($password, $owner->password)) {
if ($login_by !== "manual") {
$response_array = array('success' => false, 'error' => 'Login by mismatch', 'error_code' => 417);
$response_code = 200;
} else {
if ($owner->device_type != $device_type) {
$owner->device_type = $device_type;
}
if ($owner->device_token != $device_token) {
$owner->device_token = $device_token;
}
$owner->token_expiry = generate_expiry();
$owner->save();
$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);
$dog = Dog::find($owner->dog_id);
if ($dog !== NULL) {
$response_array = array_merge($response_array, array('dog_id' => $dog->id, 'age' => $dog->age, 'name' => $dog->name, 'breed' => $dog->breed, 'likes' => $dog->likes, 'image_url' => $dog->image_url));
}
$response_code = 200;
}
} else {
$response_array = array('success' => false, 'error' => 'Invalid Username and Password', 'error_code' => 403);
$response_code = 200;
}
} else {
$response_array = array('success' => false, 'error' => 'Not a Registered User', 'error_code' => 404);
$response_code = 200;
}
}
} elseif (Input::has('social_unique_id')) {
$social_unique_id = Input::get('social_unique_id');
$socialValidator = Validator::make(array('social_unique_id' => $social_unique_id, 'device_token' => $device_token, 'device_type' => $device_type, 'login_by' => $login_by), array('social_unique_id' => 'required|exists:owner,social_unique_id', 'device_token' => 'required', 'device_type' => 'required|in:android,ios', 'login_by' => 'required|in:manual,facebook,google'));
if ($socialValidator->fails()) {
$error_messages = $socialValidator->messages();
Log::error('Validation error during social login for owner = ' . print_r($error_messages, true));
$error_messages = $socialValidator->messages()->all();
$response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
$response_code = 200;
} else {
if ($owner = Owner::where('social_unique_id', '=', $social_unique_id)->first()) {
if (!in_array($login_by, array('facebook', 'google'))) {
$response_array = array('success' => false, 'error' => 'Login by mismatch', 'error_code' => 417);
$response_code = 200;
} else {
if ($owner->device_type != $device_type) {
$owner->device_type = $device_type;
}
if ($owner->device_token != $device_token) {
$owner->device_token = $device_token;
}
$owner->token_expiry = generate_expiry();
$owner->save();
$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);
$dog = Dog::find($owner->dog_id);
if ($dog !== NULL) {
$response_array = array_merge($response_array, array('dog_id' => $dog->id, 'age' => $dog->age, 'name' => $dog->name, 'breed' => $dog->breed, 'likes' => $dog->likes, 'image_url' => $dog->image_url));
}
$response_code = 200;
}
} else {
$response_array = array('success' => false, 'error' => 'Not a valid social registration User', 'error_code' => 404);
$response_code = 200;
}
}
} else {
$response_array = array('success' => false, 'error' => 'Invalid input', 'error_code' => 404);
$response_code = 200;
}
$response = Response::json($response_array, $response_code);
return $response;
}
示例14:
@extends('layout')
@section('content')
<div class="box box-success">
<div class="row">
<div class="col-lg-6 col-xs-6">
<!-- small box -->
<div class="small-box bg-aqua">
<div class="inner">
<h3>
<?php
$owner = Owner::where('id', $request->owner_id)->first();
if ($owner != NULL) {
echo $owner->first_name . ' ' . $owner->last_name;
}
?>
</h3>
<p>
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">
示例15: userVerify
public function userVerify()
{
$email = Input::get('email');
$password = Input::get('password');
$owner = Owner::where('email', '=', $email)->first();
if ($owner && Hash::check($password, $owner->password)) {
Session::put('user_id', $owner->id);
Session::put('user_name', $owner->first_name . " " . $owner->last_name);
Session::put('user_pic', $owner->picture);
return Redirect::to('user/trips');
} else {
return Redirect::to('user/signin')->with('error', 'Invalid email and password');
}
}