Пример #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $customer = new Customer();
     $customer->name = "John Doe";
     $customer->address = '56 James Street, Brisbane, 4000';
     $customer->phoneMob = '0495465134';
     $customer->cardNo = 1234567890123456;
     $customer->cardExpiry = '2017-12';
     $customer->cardHolder = 'John Be Doe';
     $customer->cardCcv = 123;
     $customer->save();
     $customer = new Customer();
     $customer->name = "Alison Bass";
     $customer->phoneMob = '0468795345';
     $customer->address = '57 Wright Street, Cooroy Moutain, 4563';
     $customer->cardNo = 1234567890123456;
     $customer->cardExpiry = '2017-09';
     $customer->cardHolder = 'Alison Ann Bass';
     $customer->cardCcv = 321;
     $customer->save();
 }
Пример #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     return view('admin', ['customers' => Customer::select('id', 'name', 'phoneMob', 'address')->orderBy('name')->get(), 'items' => MenuItem::all(), 'stats' => Order::adminStats(), 'customerCount' => Customer::all()->count()]);
 }
Пример #3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $validator = Validator::make($request->all(), $this->rules);
     if ($validator->passes()) {
         $customer = Customer::find($id);
         $customer->name = htmlspecialchars($request->input('name'));
         $customer->phoneMob = htmlspecialchars($request->input('phoneMob'));
         $customer->address = htmlspecialchars($request->input('address'));
         $customer->cardNo = htmlspecialchars($request->input('cardNo'));
         $customer->cardExpiry = htmlspecialchars($request->input('year') + "-" + $request->input('month'));
         $customer->cardHolder = htmlspecialchars($request->input('cardHolder'));
         $customer->cardCcv = htmlspecialchars($request->input('cardCcv'));
         $customer->save();
         return Redirect::to('customers');
     } else {
         return Redirect::action('CustomerController@edit')->withErrors($validator);
     }
 }