/** * 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')); }
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); }
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'); }
/** * 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); }
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); }
public function deliverersList() { return $this->userRepository->findWhere(['role' => 'deliveryman'])->lists('name', 'id'); }