/**
  * @param Request $request
  * @param array   $rules
  * @param array   $messages
  * @param array   $customAttributes
  */
 public function validate(Request $request, array $rules, array $messages = [], array $customAttributes = [])
 {
     $validator = $this->getValidationFactory()->make($request->all(), $rules, $messages, $customAttributes);
     if ($validator->fails()) {
         throw new ValidationHttpException($validator->errors());
     }
 }
 public function update(Request $request, $category_id, $item_id)
 {
     $item = Item::findOrFail($item_id);
     $item->fill($request->all());
     $item->save();
     return $this->success('Item atualizado');
 }
 public function update(Request $request, $order_id)
 {
     $order = Order::findOrFail($order_id);
     $order->fill($request->all());
     $order->save();
     return $this->success('Pedido atualizado');
 }
 public function update(Request $request, $id)
 {
     $categoria = Category::findOrFail($id);
     $categoria->fill($request->all());
     $categoria->save();
     return $this->success('Categoria atualizado');
 }
 public function update(Request $request, $id)
 {
     $user = User::findOrFail($id);
     $user->fill($request->all());
     $user->save();
     return $this->success('User atualizado');
 }
 public function update(Request $request, $id)
 {
     $restaurant = Restaurant::findOrFail($id);
     $restaurant->fill($request->all());
     $restaurant->save();
     return $this->success('Restaurante atualizado');
 }
Exemple #7
0
 function ACRequest(Request $request)
 {
     $this->apiUrl = "http://ac.firefly.cc/";
     $authenticator = new AcAuth("Firefly Digital", "AC Web Timer", "*****@*****.**", "&11Rebma", $this->apiUrl);
     $token = $authenticator->issueToken();
     if ($token instanceof AcToken) {
         $client = new AcClient($token);
         $params = $request->all();
         $request_type = $params['request_type'];
         $call = $params['path_info'];
         unset($params['path_info'], $params['request_type']);
         $response = $client->{$request_type}($call, $params);
         print json_encode($response->getJson());
     }
 }
 public function update(Request $request, $id)
 {
     $validator = \Validator::make($request->all(), ['id' => 'required', 'email' => 'required|email|unique:users', 'name' => 'required', 'password' => 'min:6']);
     if ($validator->fails()) {
         throw new StoreResourceFailedException('Could not able to update user.', $validator->errors());
     }
     $user = User::findorfail($id);
     $user->email = $request->get('email');
     $user->name = $request->get('name');
     if ($request->get('password')) {
         $user->password = Hash::make($request->get('password'));
     }
     if ($user->save()) {
         return $this->response->array(['message' => 'User has been updated successfully', 'status' => 200]);
     } else {
         return $this->response->array(['message' => 'Unable to update user. Please try again', 'status' => 200]);
     }
 }