Ejemplo n.º 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $exchange = Exchange::find($id);
     $respone = Input::get('respone');
     if (FEUsersHelper::isCurrentUser($exchange->r_user_id && $respone)) {
         if ($respone == 'Đồng ý') {
             Session::flash('messages', array('Đã xác nhận trao đổi'));
             $exchange->status = 1;
         } elseif ($respone == 'Xóa') {
             Session::flash('messages', array('Đã hủy yêu cầu trao đổi'));
             $exchange->status = -1;
         }
         $exchange->save();
         Session::flash('status', true);
         return Redirect::to('exchange?user_id=' . $exchange->r_user_id . '&action=receive');
     } else {
         return Redirect::to('/');
     }
 }