Ejemplo n.º 1
0
 public function postAdd(CustomerSampleRequest $request, CustomerRepository $customer)
 {
     $data = $request->all();
     $sample = null;
     if (session('customer.token')) {
         $loggedCustomer = $customer->getByToken();
         $data['customer_id'] = $loggedCustomer->id;
         $sample = $this->sample->add($data);
     }
     if ($sample) {
         $request->session()->put('customer.justaddedsample', true);
         $job = (new NotifyAdminOfNewSample($sample, config('app.locale')))->onQueue('emails');
         $this->dispatch($job);
     }
     $response = ['success' => $sample];
     return $response;
 }
Ejemplo n.º 2
0
 /**
  * We create or update the Customer.
  *
  * @param array    $data
  * @param int|null $id
  *
  * @return Customer
  */
 protected function saveCustomer(array $data = [], $id = null)
 {
     // Image Handling
     if (isset($data['image'])) {
         $data['image'] = $this->buildImage(str_slug($data['label']), $data['image']);
     }
     // We create the Customer
     if ($id === null) {
         return $this->customers->create($data);
     }
     return $this->customers->update($data, $id);
 }
Ejemplo n.º 3
0
 public function customers(CustomerRepository $customers)
 {
     return view('admin.main')->with('customers', $customers->all());
 }
Ejemplo n.º 4
0
 /**
  * Home Page.
  *
  * @return \Illuminate\View\View
  */
 public function home()
 {
     $works = $this->works->all();
     $customers = $this->customers->all();
     return view('frontend.pages.home', compact('works', 'customers'));
 }