/**
  * @param Request $request
  *
  * @return \Illuminate\Http\RedirectResponse
  * @throws \Exception
  */
 public function store(Request $request)
 {
     $data = $request->all();
     $data['client_id'] = $this->userRepository->find(Auth::user()->id)->client->id;
     $this->orderService->create($data);
     return redirect()->route('costumer.order.index');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $data = $request->all();
     $userId = $this->authorizer->getResourceOwnerId();
     $data['client_id'] = $this->userRepository->find($userId)->client->id;
     $order = $this->orderService->create($data);
     return $this->orderRepository->with('items')->find($order->id);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @param                           $role
  *
  * @return mixed
  */
 public function handle($request, Closure $next, $role)
 {
     $id = Authorizer::getResourceOwnerId();
     $user = $this->repository->find($id);
     if ($user->role != $role) {
         abort(403, 'Access Forbidden');
     }
     return $next($request);
 }