本文整理汇总了PHP中app\Customer类的典型用法代码示例。如果您正苦于以下问题:PHP Customer类的具体用法?PHP Customer怎么用?PHP Customer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Customer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 = '[email protected]';
$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);
}
开发者ID:vidmahovic,项目名称:ep-store,代码行数:34,代码来源:CustomersTableSeeder.php
示例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!";
}
}
}
开发者ID:phucanhhoang,项目名称:IT4895,代码行数:28,代码来源:CustomerController.php
示例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;
}
开发者ID:goatatwork,项目名称:access2,代码行数:11,代码来源:CustomersApiController.php
示例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']);
}
开发者ID:Laurent91700,项目名称:Star-Wars,代码行数:11,代码来源:LoginController.php
示例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();
}
开发者ID:jentleyow,项目名称:megadeal,代码行数:11,代码来源:UsersTableSeeder.php
示例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);
}
开发者ID:mg9,项目名称:koalaBazaar,代码行数:57,代码来源:UserTableSeeder.php
示例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');
}
开发者ID:jeezybrick,项目名称:laravel_first,代码行数:19,代码来源:OrdersController.php
示例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');
}
开发者ID:owlein,项目名称:laundrymgt,代码行数:12,代码来源:OrderController.php
示例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);
}
开发者ID:m-gamal,项目名称:crm,代码行数:7,代码来源:PlanController.php
示例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']));
}
开发者ID:MangTomas23,项目名称:tgm,代码行数:12,代码来源:InventoryController.php
示例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);
}
开发者ID:m-gamal,项目名称:crm,代码行数:28,代码来源:LineController.php
示例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);
}
开发者ID:m-gamal,项目名称:crm,代码行数:7,代码来源:SaleController.php
示例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);
}
开发者ID:keylukman,项目名称:latihan_aja_ya,代码行数:13,代码来源:PicController.php
示例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'));
}
开发者ID:jhruby23,项目名称:barapp,代码行数:7,代码来源:AccountController.php
示例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'));
}
开发者ID:jbcharrier,项目名称:Projet-Ecole-Multimedia-StarWars-Store,代码行数:7,代码来源:FrontController.php
示例16: store
/**
* Store the return items data
*
* @return ReturnController@index
*/
public function store()
{
$input = Input::all();
$customer = Customer::firstOrNew(['name' => $input['customer']]);
$customer->address = $input['address'];
$customer->save();
$ret = new Ret();
$ret->customer_id = $customer->id;
$ret->date = $input['date'];
$ret->reference_no = $input['ref_no'];
$ret->salesman = $input['salesman'];
$ret->area = $input['area'];
$ret->received_by = $input['received_by'];
$ret->checked_by = $input['checked_by'];
$ret->save();
foreach ($input['boxes'] as $i => $box) {
$retItem = new ReturnItem();
$retItem->ret_id = $ret->id;
$retItem->box_id = $box;
$retItem->no_of_box = $input['no_of_box'][$i];
$retItem->no_of_packs = $input['no_of_packs'][$i];
$retItem->amount = $input['amount'][$i];
$retItem->product_id = Box::find($box)->product->id;
$retItem->save();
}
return Redirect::action('InventoryController@index');
}
开发者ID:MangTomas23,项目名称:tgm,代码行数:32,代码来源:ReturnController.php
示例17: 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');
}
开发者ID:stryker250,项目名称:simple_ticket,代码行数:32,代码来源:TicketController.php
示例18: bagStore
/**
* @param LoginCustomerFormRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function bagStore(LoginCustomerFormRequest $request)
{
/////////////////////// "AUTH" CLIENT ///////////////////////
$customer_name = Input::get('customer_name');
$customer_email = Input::get('customer_email');
// si username + email (provenant des inputs) match avec ceux de la bdd :
$customer = Customer::whereRaw('username = ? and email = ?', [$customer_name, $customer_email])->first();
if (!empty($customer)) {
// on envois les datas en bdd :
$order = Order::create($request->all());
// id du client :
$customer_id = $customer->id;
$order->customer_id = $customer_id;
$order->save();
// On va associer LA commande aux produits en bdd :
$paniers = Session::get("panier");
$newItems = [];
foreach ($paniers as $panier) {
$newItems[] = ['order_id' => $order->id, 'product_id' => $panier["product_id"], 'quantity' => $panier["quantity"]];
}
DB::table('order_product')->insert($newItems);
// on vide le panier :
Session::forget('panier');
return redirect(url('/'))->with('message', 'Votre commande à bien été pris en compte !');
} else {
return redirect()->back()->with('error', 'Erreur, nom d\'utilisateur ou mot de passe incorrect !');
}
}
开发者ID:PierreMartin,项目名称:starwars,代码行数:32,代码来源:BagController.php
示例19: store
public function store()
{
$input = Input::all();
$salesman = isset($input['salesman']) ? $input['salesman'] : null;
$customer = Customer::firstOrNew(['name' => $input['name'], 'address' => $input['address']]);
$customer->save();
$order = new Order();
$order->customer_id = $customer->id;
$order->salesman_id = $salesman;
$order->date = $input['date'];
$order->type = $input['type'];
$order->save();
foreach ($input['box_id'] as $i => $box_id) {
$orderItem = new OrderItem();
$orderItem->order_id = $order->id;
$orderItem->product_id = Box::find($box_id)->product->id;
$orderItem->box_id = $box_id;
$orderItem->no_of_box = $input['no_of_box'][$i];
$orderItem->no_of_packs = $input['no_of_packs'][$i];
$orderItem->amount = $input['amount'][$i];
$orderItem->selling_price = $input['selling_price'][$i];
$orderItem->save();
}
return view('order.addmore');
}
开发者ID:MangTomas23,项目名称:tgm,代码行数:25,代码来源:OrderController.php
示例20: storeCustomer
public function storeCustomer(Request $request)
{
$this->validate($request, ['address' => 'required|max:200', 'number_card' => 'required|numeric|digits:16']);
$customer = ['user_id' => Auth::user()->id, 'address' => $request->input('address'), 'number_card' => $request->input('number_card'), 'number_command' => 0];
Customer::create($customer);
return redirect('validateCart')->with(['message' => trans('app.customerSuccess'), 'alert' => 'success']);
}
开发者ID:yinilauriot,项目名称:StarWars,代码行数:7,代码来源:RegisterController.php
注:本文中的app\Customer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论