本文整理汇总了PHP中Customer::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::where方法的具体用法?PHP Customer::where怎么用?PHP Customer::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customer
的用法示例。
在下文中一共展示了Customer::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: activitySearch
public function activitySearch()
{
$customerName = Input::get('customer');
// $allCustomers = Customer::where('company_name', 'LIKE', "%$customerName%") ->get();
$allCustomers = Customer::where('company_name', 'LIKE', "%{$customerName}%")->get();
return View::make('activities.customer-list', array('company' => $allCustomers));
}
示例2: edit_help
public function edit_help($user)
{
switch ($user->type) {
case 'customer':
Customer::where('id', '=', $user->id)->delete();
break;
case 'driver':
Driver::where('id', '=', $user->id)->delete();
break;
case 'business':
Business::where('id', '=', $user->id)->delete();
break;
default:
break;
}
$user->type = Input::get('type');
$user->save();
switch (Input::get('type')) {
case 'driver':
$driver = new Driver();
$driver->id = $user->id;
$driver->first_name = Input::get('first_name');
$driver->last_name = Input::get('last_name');
$driver->phone = Input::get('phone');
$driver->home_address = Input::get('address');
$driver->credit_card = Input::get('credit_card');
$driver->cvv = Input::get('cvv');
$driver->expiry_date = Input::get('expiry_date');
$driver->car_type = Input::get('car_type');
$driver->cab_no = Input::get('cab_no');
$driver->flag = Input::get('flag');
$driver->rate = Input::get('rate');
$driver->hour = Input::get('hour');
$driver->save();
break;
case 'customer':
$customer = new Customer();
$customer->id = $user->id;
$customer->first_name = Input::get('first_name');
$customer->last_name = Input::get('last_name');
$customer->phone = Input::get('phone');
$customer->home_address = Input::get('address');
$customer->credit_card = Input::get('credit_card');
$customer->cvv = Input::get('cvv');
$customer->expiry_date = Input::get('expiry_date');
$customer->save();
break;
case 'business':
$business = new Business();
$business->id = $user->id;
$business->business_name = Input::get('business_name');
$business->phone = Input::get('phone');
$business->home_address = Input::get('address');
$business->credit_card = Input::get('credit_card');
$business->cvv = Input::get('cvv');
$business->expiry_date = Input::get('expiry_date');
$business->save();
break;
}
}
示例3: dbMailingSender
private function dbMailingSender()
{
$customers = Customer::where('is_active', '=', 1)->get();
foreach ($customers as $customer) {
$subject = 'Hemos añadido una nueva oferta para ti, no te la pierdas!.';
$email = $customer->email;
$name = $customer->customer_name;
$title = $this->voucher->title;
$this->mail($email, $name, $title, $subject);
}
}
示例4: generateCustomerId
public function generateCustomerId()
{
$stop = null;
$customer_id = null;
do {
$customer_id = rand(1111111, 999999) . '-' . Carbon::now()->year;
//7 digit customer id
$customer = Customer::where('membership_id', $customer_id)->first();
if ($customer && !empty($customer)) {
$stop = true;
return $customer_id;
}
} while ($stop = false);
return $customer_id;
}
示例5: addCustomer
/**
* Function to add a new customer to the database
*
* Returns customer id for appointment creation
*
**/
public static function addCustomer()
{
// We get appointment information then set up our validator
$info = Session::get('appointmentInfo');
$validator = Validator::make(array('first_name' => $info['fname'], 'last_name' => $info['lname'], 'email' => $info['email']), array('first_name' => 'exists:customers,first_name', 'last_name' => 'exists:customers,last_name', 'email' => 'exists:customers,email'));
// If the validator fails, that means the user does not exist
// If any of those three variables don't exist, we create a new user
// This is so that families can use the same e-mail to book, but
// We stil create a new user for them in the database.
if ($validator->fails()) {
// Registering the new user
return Customer::create(array('first_name' => $info['fname'], 'last_name' => $info['lname'], 'contact_number' => $info['number'], 'email' => $info['email'], 'wants_updates' => Session::get('updates')))->id;
} else {
return Customer::where('email', $info['email'])->pluck('id');
}
}
示例6: searchCustomerToken
public function searchCustomerToken()
{
$str = strtolower(Input::get('gettoken'));
//$field = ( preg_match("/^[0-9 ]*$/", $str) !== 0 ) ? 'phone' : 'email';
//We check to determine if we search through phone or token
//if( $field === 'phone' ){
$field = strlen($str) < 11 ? 'token' : 'phone';
//}
$tokenInfo = Customer::where($field, '=', Input::get('gettoken'))->select('id', 'name', 'token')->get()->first();
if (!empty($tokenInfo)) {
$data['status'] = 'success';
$data['message'] = $tokenInfo->name . ' Token-ID found!';
$data['detail'] = "Name: " . $tokenInfo->name . " | Token-ID: " . $tokenInfo->token . "";
} else {
$data['status'] = 'error';
$data['message'] = 'Customer does not exist';
}
return Response::json($data);
}
示例7: Cartdetail
function list_by_parent($id, $customer_id)
{
$cartdetails = new Cartdetail();
$cartdetails->order_by('id', 'desc');
$cartdetails->where('cart_id', $id);
$cartdetails->get();
$customers = new Customer($customer_id);
$customers->order_by('id', 'asc');
$customers->where('id', $customer_id);
$customers->get();
$dis['base_url'] = base_url();
$dis['view'] = "cartdetail/listbyparent";
$dis['menu_active'] = 'Giỏ hàng';
$dis['title'] = "Chi tiết giỏ hàng";
$dis['title_customer'] = "Thông tin khách hàng";
$dis['cartdetails'] = $cartdetails;
$dis['customers'] = $customers;
$dis['nav_menu'] = array(array("type" => "back", "text" => "Back", "link" => "{$this->admin_url}carts/list_all/", "onclick" => ""));
$this->viewadmin($dis);
}
示例8: modifyPassword
/**
* 修改密码
* @return type
*/
public function modifyPassword()
{
// $oldpassword = Input::get('oldpassword');
$newpassword = Input::get('newpassword');
$msg = '密码修改失败';
if (Auth::check()) {
$name = Auth::user()->name;
// if (Hash::check($oldpassword, Auth::user()->password)) {
if ($name != $newpassword) {
$msg = '修改成功';
$result = Customer::where('id', Auth::id())->update(['password' => Hash::make($newpassword)]);
} else {
$msg = '密码与账号相同,请重新输入';
}
// }
}
if (isset($result) && $result) {
Auth::logout();
return Response::json(['err' => 0, 'msg' => $msg, 'success' => 1]);
} else {
return Response::json(['err' => 0, 'msg' => $msg, 'success' => 0]);
}
}
示例9: function
});
Route::get('booking', function () {
$cpage = 'booklst';
$r = Room::select('id', 'name')->get();
return View::make('adminview.booking.index', compact('cpage', 'r'));
});
Route::get('getbookinglist', 'BookingController@bookingList');
Route::post('getbookinglist/search', 'BookingController@searchList');
Route::post('getbookinginfo/{id}', 'BookingController@searchBooking');
Route::post('booking/{id}/update', 'BookingController@update');
Route::post('booking/{id}/payment', 'BookingController@payment');
Route::post('currentbooking/save', function () {
$i = Input::all();
$membershipDiscount = null;
if (isset($i['membership_id'])) {
$membership = Customer::where('membership_id', $i['membership_id'])->first();
if ($membership) {
$membershipDiscount = $membership->current_discount;
}
}
$booking = Booking::where('id', $i['booking_id'])->first();
if ($booking) {
$booking->firstname = $i['firstname'];
$booking->lastname = $i['lastname'];
$booking->address = $i['address'];
$booking->contact_number = $i['contact_no'];
$booking->status = 1;
$booking->save();
$reservation = ReservedRoom::where('booking_id', $i['booking_id'])->get();
if (count($reservation) > 0) {
foreach ($reservation as $r) {
示例10: delete
/**
* Remove the specified resource from storage.
* DELETE /customers/{id}
*
* @param int $id
* @return Response
*/
public function delete($id)
{
$c = Customer::where('membership_id', $id)->first();
if ($c) {
$c->delete();
}
}
示例11: update_job_order_po
public function update_job_order_po()
{
$id = Input::get('id');
/*$data['scope'] = QuotationScope::where('quotation_id', $id)->get();
echo "<pre>";
print_r($data['scope']);
die();*/
$id = Input::get('id');
$job_order = Input::all();
$job_order_da = Input::all();
$jo_daRules = array('created_at' => 'required', 'date_needed' => 'required', 'company_name' => 'required', 'revision_number' => 'required', 'type_of_work' => 'required', 'measurements_from' => 'required');
$jo_daValidator = Validator::make($job_order_da, $jo_daRules);
if ($jo_daValidator->fails()) {
return Redirect::back()->withErrors($jo_daValidator)->withInput(Input::all());
}
$job_order = Quotation::find($id);
$job_order->created_at = Input::get('created_at');
$job_order->date_needed = Input::get('date_needed');
$job_order->type_of_work_id = Input::get('type_of_work');
$job_order->po_status = 'Job Order';
$job_order->po_number = 'PO_000' . $id;
$job_order->save();
$job_order_id = $job_order->customer->id;
$scope_jo = Customer::where('id', $job_order_id)->first();
$scope_jo->name = Input::get('company_name');
$scope_jo->save();
return Redirect::to('production/back')->with('message', 'Job order updated successfully');
}
示例12: CreateAllDir
private function CreateAllDir()
{
$customer = Auth::user()->name;
$cus_id = Auth::id();
$weburl = Customer::where('id', $cus_id)->pluck('weburl');
$suf_url = str_replace('http://c', '', $weburl);
if (!file_exists(public_path('customers/' . $customer))) {
mkdir(public_path('customers/' . $customer));
}
$zip = new ZipArchive();
//新建一个ZipArchive的对象
if ($zip->open(public_path('packages/customernull.zip')) === TRUE) {
$zip->extractTo(public_path('customers/' . $customer));
}
$zip->close();
$customerinfo = Customer::find($cus_id);
$ftp_array = explode(':', $customerinfo->ftp_address);
$port = $customerinfo->ftp_port;
$ftpdir = $customerinfo->ftp_dir;
$ftp = $customerinfo->ftp;
$ftp_array[1] = isset($ftp_array[1]) ? $ftp_array[1] : $port;
$conn = ftp_connect($ftp_array[0], $ftp_array[1]);
if ($conn) {
ftp_login($conn, $customerinfo->ftp_user, $customerinfo->ftp_pwd);
ftp_pasv($conn, 1);
if (trim($ftp) == '1') {
if (ftp_nlist($conn, $customer) === FALSE) {
ftp_mkdir($conn, $customer);
}
ftp_put($conn, $customer . "/unzip.php", public_path("packages/unzip.php"), FTP_ASCII);
ftp_put($conn, $customer . "/site.zip", public_path('packages/customernull.zip'), FTP_BINARY);
@file_get_contents('http://' . $customer . $suf_url . "/unzip.php");
} else {
if (ftp_nlist($conn, $ftpdir) === FALSE) {
ftp_mkdir($conn, $ftpdir);
}
if (ftp_nlist($conn, $ftpdir . '/mobile') === FALSE) {
ftp_mkdir($conn, $ftpdir . '/mobile');
}
$domain = strlen(str_replace('http://', '', $customerinfo->pc_domain)) > 0 ? $customerinfo->pc_domain . '/mobile' : $customerinfo->mobile_domain;
ftp_put($conn, $ftpdir . "/mobile/m_unzip.php", public_path("packages/m_unzip.php"), FTP_ASCII);
ftp_put($conn, $ftpdir . "/mobile/site.zip", public_path('packages/customernull.zip'), FTP_BINARY);
@file_get_contents("{$domain}/m_unzip.php");
}
ftp_close($conn);
}
}
示例13: procOrder
public function procOrder($id)
{
$order = Order::findOrFail($id);
$order->status = 2;
$order->save();
$items = Order::findOrFail($id)->orderItems;
$user = Order::findOrFail($id)->user;
$customer = Customer::where('nama', '=', $user->nama)->first();
return View::make('admin.orders.process', compact('order', 'items', 'customer'));
}
示例14: templateUploadZip
public function templateUploadZip()
{
set_time_limit(0);
$files = Input::file();
$cus_id = Auth::id();
$temptype = Input::get("type");
$customization = Customer::where('id', $cus_id)->pluck('customization');
if ($customization <= 0 || $customization != 3 && $customization != $temptype) {
return Response::json(['err' => 1001, 'msg' => '您未开启相应的高级定制,高级定制需要付费,如需要,请联系客服', 'data' => '您未开启高级定制,高级定制需要付费,如需要,请联系客服']);
}
$files = Input::file();
$file = $files['upload_zip'];
if ($file->isValid()) {
$type = $file->getClientOriginalExtension();
$truth_name = date('ymd') . mt_rand(100, 999) . '.' . $type;
if ($type == "zip") {
if (file_exists(public_path("temp_templates/{$truth_name}"))) {
$result = ['err' => 1000, 'msg' => '模板覆盖成功'];
} else {
$up_result = $file->move(public_path("temp_templates/"), $truth_name);
if ($up_result) {
if ($temptype == 1) {
$name = WebsiteInfo::leftJoin('template', 'pc_tpl_id', '=', 'template.id')->where('website_info.cus_id', $cus_id)->pluck('name');
} else {
$name = WebsiteInfo::leftJoin('template', 'mobile_tpl_id', '=', 'template.id')->where('website_info.cus_id', $cus_id)->pluck('name');
}
$tpl_name = $name;
$result = $this->saveTemplate($truth_name, $tpl_name, $temptype);
$pushed = WebsiteInfo::where("cus_id", $cus_id)->pluck("pushed");
if ($temptype == 1) {
if ($pushed == 0 || $pushed == 2) {
$pushed = 2;
} else {
$pushed = 1;
}
} else {
if ($pushed == 0 || $pushed == 3) {
$pushed = 3;
} else {
$pushed = 1;
}
}
WebsiteInfo::where("cus_id", $cus_id)->update(array("pushed" => $pushed));
} else {
$result = ['err' => 1001, 'msg' => '模板覆盖失败'];
}
}
} else {
$result = ['err' => 1002, 'msg' => '模板覆盖失败,请上传正确的文件类型'];
}
} else {
$result = ['err' => 1002, 'msg' => '模板覆盖失败,请上传正确的文件类型'];
}
return Response::json($result);
}
示例15: getFacebook
function getFacebook()
{
$auth = Config::get('hybridauth');
$config = array("base_url" => URL::to('user/google'), "providers" => array("Facebook" => array("enabled" => true, "keys" => array("id" => $auth['providers']['Facebook']['keys']['id'], "secret" => $auth['providers']['Facebook']['keys']['secret']))));
if (isset($_REQUEST['hauth_start']) || isset($_REQUEST['hauth_done'])) {
Hybrid_Endpoint::process();
}
$socialAuth = new Hybrid_Auth($config);
$provider = $socialAuth->authenticate("facebook");
$userProfile = $provider->getUserProfile();
$provider->logout();
$user = Customer::where('email', '=', $userProfile->email)->first();
return self::autoSigninCus($user, $userProfile);
//$user = User::where('email','=',$userProfile->email)->first();print_r($user);
//return self::autoSignin($user);
}