本文整理汇总了PHP中app\Customer::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::select方法的具体用法?PHP Customer::select怎么用?PHP Customer::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Customer
的用法示例。
在下文中一共展示了Customer::select方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: totalMonthlyCoverage
public static function totalMonthlyCoverage()
{
$visitClass = Customer::select('class')->where('mr_id', \Auth::user()->id)->get()->toArray();
$totalVisitsCount = VisitClass::whereIn('name', $visitClass)->sum('visits_count');
$actualVisitsCount = Report::where('mr_id', \Auth::user()->id)->where('month', date('M') . '-' . date('Y'))->count();
return number_format($actualVisitsCount / $totalVisitsCount * 100, 2);
}
示例2: search
public function search()
{
$classes = VisitClass::all();
$specialties = Customer::select('specialty')->distinct()->get();
$MRs = Employee::where('level_id', 7)->get();
$dataView = ['classes' => $classes, 'specialties' => $specialties, 'MRs' => $MRs];
return view('admin.search.coverage.search', $dataView);
}
示例3: getNextId
public static function getNextId()
{
$id = Customer::select("customer_id")->orderBy("customer_id", 'decs')->first()->customer_id + 1;
if ($id) {
return $id;
}
return 1;
}
示例4: tires
public function tires()
{
$customers = Customer::select(["customer_id", "name"])->orderBy('name')->get();
return view('tire.tires', compact('customers'));
}
示例5: getCustomers
public function getCustomers()
{
return Customer::select(['customer_id', 'name'])->orderBy('name')->get();
}
示例6: search
/**
* Search Customer function
*/
public function search(Request $request)
{
$keywords = $request->input('keywords');
$column = ['id', 'created_at', 'owner', 'rego', 'make', 'model', 'colour'];
$customers = Customer::select($column)->where('owner', 'like', '%' . $keywords . '%')->orWhere('rego', 'like', '%' . $keywords . '%')->orWhere('make', 'like', '%' . $keywords . '%')->orWhere('model', 'like', '%' . $keywords . '%')->orWhere('colour', 'like', '%' . $keywords . '%')->get();
return view('crashzone.partials.search_result', compact('customers'));
}
示例7: create
public function create()
{
$customers = Customer::select(["customer_id", "name"])->orderBy('name')->get();
return view('order.create_order', compact("customers"));
}
示例8: specialtyCoverageStats
public function specialtyCoverageStats($mrId)
{
$totalVisits = [];
$actualVisits = [];
$specialtyCoverage = [];
$specialty = NULL;
$counter = 0;
$allSpecialties = Customer::select('specialty')->where('mr_id', $mrId)->get()->toArray();
$allCustomersSpecialties = Customer::whereIn('specialty', $allSpecialties)->get()->toArray();
// Get all medical rep customers specialties
foreach ($allCustomersSpecialties as $singleCustomer) {
$allSpecialtyClasses[$singleCustomer['specialty']] = Customer::select('class')->where('specialty', $singleCustomer['specialty'])->get()->toArray();
}
// Get all customer classes based on specialty
foreach ($allSpecialtyClasses as $specialty => $specialtyClasses) {
// Calculate total visits based on classes and specialty
foreach ($specialtyClasses as $singleSpecialtyClass) {
if (isset($totalVisits[$specialty])) {
$totalVisits[$specialty] += VisitClass::where('name', $singleSpecialtyClass)->first()->visits_count;
} else {
$totalVisits[$specialty] = VisitClass::where('name', $singleSpecialtyClass)->first()->visits_count;
}
}
}
// Get all doctors visited
$doctorsVisited = Report::select('doctor_id')->where('month', date('M-Y'))->where('mr_id', $mrId)->get()->toArray();
foreach ($doctorsVisited as $singleDoctor) {
// calculate actual visits
$specialty = Customer::select('specialty')->findOrFail($singleDoctor)->first()->specialty;
if (isset($actualVisits[$specialty])) {
$actualVisits[$specialty] += 1;
} else {
$actualVisits[$specialty] = 1;
}
}
foreach ($allCustomersSpecialties as $singleCustomerSpecialty) {
$specialty = $singleCustomerSpecialty['specialty'];
$specialtyCoverage[$specialty] = 0;
if (isset($specialtyCoverage[$specialty]) && isset($actualVisits[$specialty]) && isset($totalVisits[$specialty])) {
$specialtyCoverage[$specialty] = number_format($actualVisits[$specialty] / $totalVisits[$specialty] * 100, 2);
}
}
foreach ($specialtyCoverage as $specialty => $percentage) {
if (isset($specialtyCoverage[$specialty])) {
$stats[$counter]['label'] = $specialty;
$stats[$counter]['data'] = $percentage;
}
$counter++;
}
return $stats;
}