本文整理汇总了PHP中app\Customer类的典型用法代码示例。如果您正苦于以下问题:PHP Customer类的具体用法?PHP Customer怎么用?PHP Customer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Customer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$employee_ids = Employee::all()->lists('id')->toArray();
$order_states = OrderState::lists('id')->toArray();
$products = Product::all();
$municipalities = Municipality::all();
factory(App\Customer::class, 50)->create()->each(function ($customer) use($employee_ids, $products, $municipalities, $order_states) {
shuffle($employee_ids);
shuffle($order_states);
$customer->user()->save(factory(User::class, 'customer')->create());
$customer->city_id = $municipalities->shuffle()->first()->id;
$customer->save();
$customer->products()->attach($products->shuffle()->first(), ['vote' => rand(1, 5), 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]);
$customer->orders()->save(factory(App\Order::class)->create(['acquired_by' => $employee_ids[0], 'state_id' => $order_states[0]]));
});
$user = new User();
$user->name = 'Vid';
$user->surname = 'Mahovic';
$user->email = 'vid.mahovic@gmail.com';
$user->password = 'vid123';
$user->verified = true;
$user->save();
$customer = new Customer();
$customer->street = 'Celovška 21';
$customer->city_id = $municipalities->shuffle()->first()->id;
$customer->phone = '+38640850993';
$customer->save();
$customer->user()->save($user);
}
示例2: saveCustomer
public function saveCustomer(Request $request)
{
if ($request->customer_id != "") {
$customer = Customer::find($request->customer_id);
$customer->name = $request->name;
$customer->phone = $request->phone;
$customer->address = $request->address;
User::where('userable_id', '=', $request->customer_id)->update(['email' => $request->email, 'banned' => $request->banned]);
$check = $customer->save();
if ($check) {
return "EDIT_SUCCEED";
} else {
return "Có lỗi xảy ra. Vui lòng thử lại sau!";
}
} else {
$customer = new Customer();
$customer->name = $request->name;
$customer->phone = $request->phone;
$customer->address = $request->address;
$check = $customer->save();
if ($check) {
$data = array('msg' => 'ADD_SUCCEED', 'customer_id' => $customer->id);
return $data;
} else {
return "Có lỗi xảy ra. Vui lòng thử lại sau!";
}
}
}
示例3: delete
/**
* Delete a customer
*/
public function delete(Customer $customer)
{
logThis('Customer Deleted: ' . $customer->name . ' was deleted.');
$this->dispatch(new RemoveFromMonitoring($customer));
$customer->delete();
$this->dispatch(new RewriteDhcpConfig());
return $customer;
}
示例4: saveCustomer
public function saveCustomer(Request $request)
{
$this->validate($request, ['address' => 'required|max:200', 'number_card' => 'required|numeric|digits:16']);
$c = new Customer();
$c->user_id = Auth::user()->id;
$c->address = $request->address;
$c->number_card = $request->number_card;
$c->number_command = 0;
$c->save();
return redirect('commande')->with(['message' => 'Votre inscription est complete', 'alert' => 'success']);
}
示例5: generateCustomerSeed
private function generateCustomerSeed($email, $password, $firstname, $surname, $dob)
{
$user = ['email' => $email, 'password' => bcrypt($password), 'role' => '1'];
$user = User::create($user);
$customer = new Customer();
$customer->user_id = $user->id;
$customer->firstname = $firstname;
$customer->surname = $surname;
$customer->dob = $dob;
$customer->save();
}
示例6: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$user = new User();
$user->name = 'mugekural';
$user->surname = str_random(10);
$user->email = $user->name . '@gmail.com';
$user->is_active = true;
$user->password = bcrypt('12345');
$user->type = 'App\\Supplier';
$user->save();
$supplier = new Supplier();
$supplier->phone = '023123';
$supplier->id = $user->id;
$supplier->save();
$user2 = new User();
$user2->name = str_random(10);
$user2->surname = str_random(10);
$user2->email = $user2->name . '@gmail.com';
$user2->is_active = true;
$user2->type = 'App\\Customer';
$user2->save();
$customer = new Customer();
$customer->phone = "053247557437";
$customer->id = $user2->id;
$customer->save();
$instagram = new InstagramAccount();
$instagram->instagram_id = "1231231";
$instagram->access_token = "asdaddads";
$instagram->username = "farukaladag";
$instagram->full_name = "omer faruk";
$instagram->bio = "fdsfasfdsf";
$instagram->website = "string";
$instagram->profile_picture = "";
$supplier->instagramAccount()->save($instagram);
$product = new Product();
$product->supplier_id = $supplier->id;
$product->id = "235";
$product->is_active = true;
$product->title = "kitap";
$product->description = "martı";
$product->price = "340";
$product->save();
$instagram2 = new InstagramAccount();
$instagram2->instagram_id = "700797";
$instagram2->access_token = "fjfjjfjfjf";
$instagram2->username = "mug9";
$instagram2->full_name = "muge kural";
$instagram2->bio = "comp stud";
$instagram2->website = "some string";
$instagram2->profile_picture = "";
$customer->instagramAccount()->save($instagram2);
}
示例7: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$input = Request::all();
$avto = new Avto($input);
$repair = new Repair($input);
$customer = new Customer($input);
$avto->save();
$repair->save();
$customer->save();
$order = new Order(['date' => $input['date'], 'd_avto' => $avto->id, 'd_r' => $repair->id, 'customer_id' => $customer->id]);
$order->save();
// dd($avto);<--Для дебага
return redirect('orders/ordersuccess');
}
示例8: create
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
$customers = Customer::all();
// return view('order.create',compact('customers', $customers));
return view('order.create', array('customers' => $customers));
// return view('order.create');
}
示例9: create
public function create()
{
$employees = Employee::select('id')->where('manager_id', \Auth::user()->id)->get();
$doctors = Customer::whereIn('mr_id', $employees)->get();
$dataView = ['doctors' => $doctors];
return view('am.plan.create', $dataView);
}
示例10: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$suppliers = Supplier::orderBy('name')->get();
$employees = Employee::orderBy('firstname')->get();
$customers = Customer::orderBy('name')->get();
return view('inventory.home', compact(['suppliers', 'employees', 'customers']));
}
示例11: 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);
}
示例12: 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);
}
示例13: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($idpic)
{
$pic = Pic::find($idpic);
$cust = Customer::all();
$data = array('pic' => $pic, 'cust' => $cust);
return View('pic.edit')->with('data', $data);
}
示例14: showGroup
public function showGroup()
{
$customer_id = Auth::user()->customer->id;
$group = User::with('unpaidOrders')->where('customer_id', $customer_id)->get();
$spendings = Customer::find($customer_id)->unpaidOrders->sum('total_price');
return view('account.group', compact('group', 'spendings'));
}
示例15: 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'));
}