/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id, UserRepository $userRepository)
 {
     $listStatus = ['0' => 'Pendente', '1' => 'Enviado', '2' => 'Entregue'];
     $order = $this->order->find($id);
     $deliveryman = $userRepository->getDeliverymen();
     return view('admin.orders.edit', compact('order', 'listStatus', 'deliveryman'));
 }
예제 #2
0
 public function create(array $data)
 {
     $data['user']['password'] = bcrypt(123456);
     $user = $this->userRepository->create($data['user']);
     $data['user_id'] = $user->id;
     $this->clientRepository->create($data);
 }
예제 #3
0
 public function index()
 {
     $clientId = $this->userRepository->find(Auth::user()->id)->client->id;
     $orders = $this->orderRepository->scopeQuery(function ($query) use($clientId) {
         return $query->where('client_id', '=', $clientId);
     })->paginate(5);
     return view('customer.order.index', compact('orders'));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CheckoutRequest $request)
 {
     $data = $request->all();
     $clientId = $this->userRepository->find(Auth::user()->id)->client->id;
     $data['client_id'] = $clientId;
     $this->orderService->create($data);
     return redirect()->route('customer.checkout.index');
 }
예제 #5
0
 /**
  * Handle an incoming request.
  *
  * @param  IlluminateHttpRequest  $request
  * @param  Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next, $role)
 {
     $id = Authorizer::getResourceOwnerId();
     $user = $this->userRepository->find($id);
     if ($user->role != $role) {
         abort(403, 'Access Forbidden');
     }
     return $next($request);
 }
예제 #6
0
 public function edit($id, UserRepository $userRepository)
 {
     $list_status = [0 => 'Pendente', 1 => 'A caminho', 2 => 'Entregue', 3 => 'Cancelado'];
     $order = $this->orderRepository->find($id);
     $deliveryman = $userRepository->getDeliveryman();
     //where
     //Buscando categorias dos produtos
     return view('admin.orders.edit', compact('order', 'list_status', 'deliveryman'));
 }
 public function index()
 {
     $id = Authorizer::getResourceOwnerId();
     $clientId = $this->userRepository->find($id)->client->id;
     $orders = $this->orderRepository->skipPresenter(false)->with($this->whith)->scopeQuery(function ($query) use($clientId) {
         return $query->where('client_id', '=', $clientId);
     })->paginate(5);
     return $orders;
 }
 public function getAuthenticatedUser()
 {
     $id = Authorizer::getResourceOwnerId();
     return $this->userRepository->with('client')->find($id);
 }
 public function update(array $data, $id)
 {
     $client = $this->client->update($data, $id);
     $this->user->update($data["user"], $client->user->id);
 }
예제 #10
0
 public function deliverersList()
 {
     return $this->userRepository->findWhere(['role' => 'deliveryman'])->lists('name', 'id');
 }