本文整理汇总了PHP中app\Customer::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::where方法的具体用法?PHP Customer::where怎么用?PHP Customer::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Customer
的用法示例。
在下文中一共展示了Customer::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
/**
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function boot(Router $router)
{
//
parent::boot($router);
/*Route::model*/
/**
* Route model binding altering default logic
* $router->bind('articles',function($id){
* return \App\Article::published()->findOrFail($id);
* });
*/
/*Using wildcard*/
/*$router->model('articles','App\Article');*/
$router->bind('articles', function ($id) {
return \App\Article::published()->findOrFail($id);
});
$router->bind('rates', function ($id) {
return \App\Rate::where('id', $id)->firstOrFail();
});
$router->bind('customers', function ($id) {
return \App\Customer::where('id', $id)->firstOrFail();
});
$router->bind('tags', function ($name) {
return \App\Tag::where('name', $name)->firstOrFail();
});
$router->bind('motherboards', function ($name) {
return \App\Motherboard::where('name', $name)->firstOrFail();
});
}
示例2: profileUpdate
/**
* Get request from profile form and update the fields of the Customer instance.
* Then redirect to their intended location or '/'
*
* @param Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function profileUpdate(UpdateProfileRequest $request)
{
// Retrieve all data in $request to an array
$data = $request->all();
// Find and retrieve the appropriate Customer instance
$customer = Customer::where('email', Auth::user()->email)->first();
// Update the details
$customer->name = $data['name'];
$customer->NIC_passport_num = $data['ID'];
$customer->telephone_num = $data['telephone'];
$customer->address_line_1 = $data['address_line1'];
$customer->address_line_2 = $data['address_line2'];
$customer->city = $data['city'];
$customer->province_state = $data['province'];
$customer->zip_code = $data['zipCode'];
$customer->country = $data['country'];
// Save the updated Customer instance
$customer->save();
//this lines are added, if the user is facebook logged in user he needs to fill his other details and he should be
//redirected to payment page, since return redirect()->intended() is not working for this purpose
if (Session::has('fblogin_payment')) {
return redirect('payment');
}
return redirect()->intended('/')->with('success', 'Your details have been updated successfully.');
}
示例3: single
public function single($mr, $currentMonth)
{
$actualVisits = [];
$MonthlyCustomerProducts = [];
$MRLine = [];
$doctors = Customer::where('mr_id', $mr)->get();
foreach ($doctors as $singleDoctor) {
$actualVisits[$singleDoctor->id] = Report::where('mr_id', $mr)->where('month', $currentMonth)->where('doctor_id', $singleDoctor->id)->count();
$MonthlyCustomerProducts[$singleDoctor->id] = Customer::monthlyProductsBought([$singleDoctor->id])->toArray();
}
$products = Product::where('line_id', Employee::findOrFail($mr)->line_id)->get();
$coverageStats = Employee::coverageStats($mr, $currentMonth);
$allManagers = Employee::yourManagers($mr);
$totalProducts = Employee::monthlyDirectSales($mr, $currentMonth);
$totalSoldProductsSales = $totalProducts['totalSoldProductsSales'];
$totalSoldProductsSalesPrice = $totalProducts['totalSoldProductsSalesPrice'];
$currentMonth = \Carbon\Carbon::parse($currentMonth);
$lines = MrLines::select('line_id', 'from', 'to')->where('mr_id', $mr)->get();
foreach ($lines as $line) {
$lineFrom = \Carbon\Carbon::parse($line->from);
$lineTo = \Carbon\Carbon::parse($line->to);
if (!$currentMonth->lte($lineTo) && $currentMonth->gte($lineFrom)) {
$MRLine = MrLines::where('mr_id', $mr)->where('line_id', $line->line_id)->get();
}
}
$dataView = ['doctors' => $doctors, 'MonthlyCustomerProducts' => $MonthlyCustomerProducts, 'actualVisits' => $actualVisits, 'products' => $products, 'totalVisitsCount' => $coverageStats['totalVisitsCount'], 'actualVisitsCount' => $coverageStats['actualVisitsCount'], 'totalMonthlyCoverage' => $coverageStats['totalMonthlyCoverage'], 'allManagers' => $allManagers, 'totalSoldProductsSales' => $totalSoldProductsSales, 'totalSoldProductsSalesPrice' => $totalSoldProductsSalesPrice, 'MRLines' => $MRLine];
return view('am.line.single', $dataView);
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate($request, ['subject' => 'required|max:255', 'product' => 'required', 'group' => 'required', 'severity' => 'required', 'description' => 'required']);
$settings = Settings::where('name', 'ticket_track_id')->first();
$track_id = $settings->str_value;
$customer = Customer::where('id', $this->my_customer_id)->first();
$search_strings = ['%COMPANY_NAME', '%Y', '%m', '%d'];
$value_strings = [str_replace(' ', '_', $customer->name), date('Y', time()), date('m', time()), date('d', time())];
$track_id = str_replace($search_strings, $value_strings, $track_id);
$ticket = Ticket::create(['subject' => $request->subject, 'track_id' => $track_id, 'description' => $request->description, 'group_id' => $request->group, 'severity_id' => $request->severity, 'product_id' => $request->product, 'user_id' => $this->my_id, 'customer_id' => $this->my_customer_id, 'status_id' => 1]);
if (isset($request->attachments)) {
foreach ($request->attachments as $attachment) {
// Check that the directory exists
$uploadPath = storage_path() . '/attachments/' . $ticket->id;
$fs = new Filesystem();
if (!$fs->isDirectory($uploadPath)) {
// Create the directory
$fs->makeDirectory($uploadPath);
}
$attachment->move($uploadPath, $attachment->getClientOriginalName());
$_attachment = Attachment::create(['user_id' => $this->my_id, 'name' => $attachment->getClientOriginalName(), 'ticket_id' => $ticket->id]);
}
}
$this->dispatch(new EmailNewTicket($ticket));
return redirect('/tickets');
}
示例5: stores
public function stores()
{
$accounts = Account::all();
$data = array();
foreach ($accounts as $account) {
$customers = Customer::where('account_id', $account->id)->get();
$account_children = array();
foreach ($customers as $customer) {
$areas = Area::where('customer_id', $customer->id)->get();
$customer_children = array();
foreach ($areas as $area) {
$regions = Region::where('area_id', $area->id)->get();
$area_children = array();
foreach ($regions as $region) {
$distributors = Distributor::where('region_id', $region->id)->get();
$region_children = array();
foreach ($distributors as $distributor) {
$stores = Store::where('distributor_id', $distributor->id)->get();
$distributor_children = array();
foreach ($stores as $store) {
$distributor_children[] = array('title' => $store->store, 'key' => $account->id . "." . $customer->id . "." . $area->id . "." . $region->id . "." . $distributor->id . "." . $store->id);
}
$region_children[] = array('select' => true, 'title' => $distributor->distributor, 'isFolder' => true, 'key' => $account->id . "." . $customer->id . "." . $area->id . "." . $region->id . "." . $distributor->id, 'children' => $distributor_children);
}
$area_children[] = array('select' => true, 'title' => $region->region, 'isFolder' => true, 'key' => $account->id . "." . $customer->id . "." . $area->id . "." . $region->id, 'children' => $region_children);
}
$customer_children[] = array('select' => true, 'title' => $area->area, 'isFolder' => true, 'key' => $account->id . "." . $customer->id . "." . $area->id, 'children' => $area_children);
}
$account_children[] = array('select' => true, 'title' => $customer->customer, 'isFolder' => true, 'key' => $account->id . "." . $customer->id, 'children' => $customer_children);
}
$data[] = array('title' => $account->account, 'isFolder' => true, 'key' => $account->id, 'children' => $account_children);
}
return response()->json($data);
}
示例6: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$customer = Customer::where('id', $id)->orWhere('slug', $id)->firstOrFail();
$snippets = $customer->snippets;
$persons = $customer->persons;
return view('customers.show', compact('customer', 'snippets', 'persons'));
}
示例7: userHistoric
public function userHistoric()
{
$user_id = Auth::user()->id;
$customer_id = Customer::where('user_id', '=', $user_id)->value('id');
$histories = History::where('customer_id', '=', $customer_id)->get();
return view('front.user_historic', compact('histories'));
}
示例8: search
public function search()
{
$products = Product::where('line_id', Employee::find(\Auth::user()->id)->line_id)->get();
$doctors = Customer::where('mr_id', \Auth::user()->id)->get();
$dataView = ['products' => $products, 'doctors' => $doctors];
return view('mr.search.sales.search', $dataView);
}
示例9: getViewCustomer
public function getViewCustomer($id)
{
$customer = Customer::where("id", $id)->with("companies")->with("user")->with(['jobs' => function ($q) {
$q->where("company_id", Auth::user()->company_id);
}])->first();
$total = Job::where("customer_id", $id)->count();
return view("customer", ["customer" => $customer, "total" => $total]);
}
示例10: gymaccess
public function gymaccess($id)
{
$customer = \App\Customer::where('id', $id)->firstOrFail();
/*$activationDate = Carbon::today();*/
$activationDate = Carbon::today()->format('F d\\, Y');
$rates = Rate::where('member_ind', $customer->membership_ind)->where('per_session_ind', '!=', 1)->lists('rate', 'id', 'price');
return view('customers.gymaccess', compact('customer', 'rates', 'activationDate'));
}
示例11: userExists
protected function userExists($data)
{
$customer = Customer::where('email', $data['email'])->first();
if ($customer == '' || empty($customer)) {
return false;
} else {
return true;
}
}
示例12: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
if (Auth::user()->admin == 1) {
$customer = Customer::findOrFail($id);
} else {
$customer = Customer::where('group', Auth::user()->group)->where('id', $id)->firstOrFail();
}
return view('customer.show', ['customer' => $customer]);
}
示例13: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
// return view('customer.show');
$search = \Request::get('search');
//<-- we use global request to get the param of URI
$customers = Customer::where('name', 'like', '%' . $search . '%')->orderBy('name')->paginate(20);
return view('customer.list', array('customers' => $customers));
// $customers = Customer::all();
// return view('customer.list', array('customers' => $customers));
}
示例14: customers
public function customers()
{
$search = \Input::get('q');
if ($search) {
$customers = \App\Customer::where('firstname', 'like', $search . '%')->orWhere('lastname', 'like', $search . '%')->orderBy('created_at', 'desc')->paginate($this->limit);
} else {
$customers = \App\Customer::orderBy('created_at', 'desc')->paginate($this->limit);
}
return view('admin.pages.customers', compact('customers'));
}
示例15: customers
public function customers()
{
$term = \Input::get('term');
$customers = Customer::where('customer_name', 'like', "%{$term}%")->orderBy('customer_name', 'asc')->get();
$json = [];
foreach ($customers as $c) {
array_push($json, array('value' => $c->id, 'label' => $c->customer_name));
}
return response()->json($json);
}