本文整理汇总了PHP中app\Customer::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::create方法的具体用法?PHP Customer::create怎么用?PHP Customer::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Customer
的用法示例。
在下文中一共展示了Customer::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker\Factory::create();
for ($i = 0; $i < 10; ++$i) {
Customer::create(['name' => $faker->name, 'email' => $faker->email, 'phone' => $faker->phoneNumber, 'address' => $faker->address, 'password' => Hash::make($faker->word)]);
}
}
示例2: run
public function run()
{
Illuminate\Support\Facades\DB::table('customers')->delete();
for ($i = 0; $i < 50; $i++) {
Customer::create(['name' => '测试客户' . ($i + 1), 'phoneNum' => (string) (15253212675.0 + $i), 'wx' => 'jm_god_father_' . $i, 'address' => '青岛市香港中路132号3号楼1505', 'customer_category_id' => $i % 2 == 0 ? 1 : 2]);
}
}
示例3: redeemCoupon
public function redeemCoupon(request $request)
{
$rules = array('client_id' => 'required', 'client_secret' => 'required', 'code' => 'required', 'mobile' => 'required|size:10', 'email' => 'required|email|max:255');
$validator = $this->customValidator($request->all(), $rules, array());
if ($validator->fails()) {
return response()->json(['response_code' => 'ERR_RULES', 'message' => $validator->errors()->all()], 400);
}
$auth = $request->only('client_id', 'client_secret');
$server = ['client_id' => Config::get('custom.client_id'), 'client_secret' => Config::get('custom.client_secret')];
if ($server['client_id'] != $auth['client_id'] || $server['client_secret'] != $auth['client_secret']) {
return response()->json(['response_code' => 'ERR_IAC', 'messages' => 'Invalid Api credentials'], 403);
}
$code = $request->only('code');
$matchThese = ['code' => $code['code'], 'is_active' => true];
$store = Store::where($matchThese)->first();
if ($store == '' || empty($store)) {
return response()->json(['response_code' => 'ERR_CCNV', 'message' => 'Coupon Code Not valid'], 409);
}
if ($this->userExists($request->only('email'))) {
return response()->json(['response_code' => 'ERR_UAUC', 'message' => 'User Already Used Coupon'], 409);
}
$input = $request->only('name', 'email', 'mobile');
$input['store_id'] = $store->id;
$customer = Customer::create($input);
$data['timer'] = $store->timer;
$data['offer_image'] = URL::to('/assets/img/stores/') . $store->offer_image;
return response()->json(['response_code' => 'RES_CRS', 'message' => 'Coupon Redeemed successfully', 'data' => $data]);
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
// dd($request->all());
$input = $request->all();
Customer::create($input);
return redirect()->route('customer.index');
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @param StoreCustomerRequest|Request $request
* @return \Illuminate\Http\Response
*/
public function store(StoreCustomerRequest $request)
{
$user = Customer::create(['phone' => $request->get('phone'), 'street' => $request->get('street'), 'city_id' => $request->get('city_id')]);
$customer = User::create(['name' => $request->get('name'), 'surname' => $request->get('surname'), 'email' => $request->get('email'), 'password' => $request->get('password')]);
$customer->user()->save($user);
return redirect('/user')->with('customers', 'Stranka ' . $user->name . ' ' . $user->surname . ' je bila uspešno ustvarjena.');
}
示例6: 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']);
}
示例7: postNewCustomer
public function postNewCustomer(NewCustomerRequest $request, Customer $customer, CustomerProfile $profile, Payment $payment)
{
$this->customer = $customer->create(['firstname' => Str::title($request->input('firstname')), 'lastname' => Str::title($request->input('lastname')), 'email' => Str::lower($request->input('email')), 'phone' => $request->input('phone')]);
if ($this->customer) {
$dob = explode('/', $request->input('dob'));
$dob_piece = [$dob[2], $dob[1], $dob[0]];
$this->profile = $profile->create(['customer_id' => $this->customer->id, 'dob' => implode('-', $dob_piece), 'gender_id' => $request->input('gender'), 'state_id' => $request->input('state_of_origin'), 'hostel_address' => $request->input('hostel_address'), 'guardian_name' => Str::words($request->input('guardian_name')), 'guardian_phone' => $request->input('guardian_phone'), 'guardian_address' => $request->input('guardian_address')]);
// Add Payment Balance
$this->payment = $payment->create(['customer_id' => $this->customer->id, 'start_balance' => empty($request->input('account_balance')) ? 0 : $request->input('account_balance'), 'account_balance' => empty($request->input('account_balance')) ? 0 : $request->input('account_balance')]);
// Generate THC Code
$thc_code = thcFormater($this->customer->id);
// Generate QR Code
generateQRCode($thc_code);
// Add Customer THC generated code
$customer->whereId($this->customer->id)->update(['thc' => $thc_code, 'qrcode' => '/customers/qrcodes/' . $thc_code . '.png']);
if ($this->profile) {
flash()->success('Customer Added Successfully!');
} else {
flash()->error('An error occurred, try adding the Customer again!');
}
} else {
flash()->error('An error occurred, try adding the Customer again!');
}
return redirect()->route('customer.list');
}
示例8: create
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
$user = User::create(['name' => $data['name'], 'surname' => $data['surname'], 'email' => $data['email'], 'password' => $data['password'], 'token' => str_random(30)]);
$customer = Customer::create(['street' => $data['street'], 'phone' => $data['phone'], 'city_id' => $data['city_id']]);
$customer->user()->save($user);
return $customer;
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$customer = Customer::create($request->all());
if (session('pp_new_order', false)) {
return redirect()->to('/order/create/' . $customer->id);
}
return redirect()->route('customer.index');
}
示例10: store
public function store(CustomerCreateRequest $request)
{
$customer = Customer::create($request->postFillData());
$customerid = $customer->id;
$employeeid = Auth::user()->id;
$log = ActivityLog::create(['employee_id' => $employeeid, 'activity' => 'Add Customer', 'table_affected' => 'customer', 'primary_key' => $customerid, 'column_affected' => 'all']);
return redirect()->route('erp_system.customer.index')->withSuccess('New Customer Successfully Created.');
}
示例11: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$json = File::get(storage_path() . '/jsondata/customers.json');
$data = json_decode($json);
foreach ($data as $obj) {
Customer::create(array('id' => $obj->id, 'fullname' => $obj->fullname, 'customer_type' => $obj->customer_type, 'address_id' => $obj->address_id, 'soDienThoai' => $obj->soDienThoai, 'tenCongTy' => $obj->tenCongTy, 'maSoThue' => $obj->maSoThue));
}
}
示例12: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$customer;
if ($customer = Customer::create($request->all())) {
return redirect()->route('show', ['id' => $customer->id]);
} else {
return 'error';
}
}
示例13: 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, $this->rules);
$input = Input::all();
$input['user_id'] = Auth::User()->id;
Customer::create($input);
Session::flash('flash_message', 'Customer created successfully!');
return Redirect::route('customer.index')->with('Customer created.');
}
示例14: store
public function store(Request $request)
{
$validator = Validator::make(['first_name' => $request->get('first_name'), 'last_name' => $request->get('last_name'), 'email' => $request->get('email')], ['first_name' => 'required', 'last_name' => 'required', 'email' => 'required|email']);
if ($validator->fails()) {
return Response::make('Please check your input.', 400);
} else {
$customer = Customer::create($request->all());
return $customer;
}
}
示例15: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
DB::table('customers')->delete();
$customers = array(['first_name' => 'John', 'last_name' => 'Doe', 'email' => 'john@doe.com', 'notes' => 'Parts unknown'], ['first_name' => 'Jane', 'last_name' => 'Smith', 'email' => 'jane@smith.com']);
foreach ($customers as $c) {
Customer::create($c);
}
Model::reguard();
}