/**
  * Remove the specified resource from storage.
  * @return Response
  */
 public function deleteFlight()
 {
     if (Request::ajax()) {
         $id = Input::get('id');
         $status = FALSE;
         $view = NULL;
         $item = AdFlightAdvertiserManagerModel::find($id);
         if ($item) {
             $adId = $item->ad_id;
             $adData = AdBaseModel::find($adId);
             if ($item->delete()) {
                 $status = TRUE;
                 $this->data['flightAdList'] = $adData->flightAd;
                 $view = View::make('flightList', $this->data)->render();
             }
         }
         return Response::json(array('status' => $status, 'view' => $view));
     }
 }
 /**
  *     SaveOrder
  *     @param  integer $id
  */
 function saveOrder()
 {
     if (Request::ajax()) {
         $listorder = $_POST['menu'];
         if (is_array($listorder)) {
             $order = 1;
             foreach ($listorder as $id => $value) {
                 $item = AdFlightAdvertiserManagerModel::find($id);
                 $item->order = $order;
                 $item->update();
                 $order++;
             }
             return "TRUE";
         }
         return "FALSE";
     }
 }
 /**
  *     Load Modal Add/Edit Flight
  *     @param  integer  $id
  *     @return Response
  */
 public function loadModal()
 {
     if (Request::ajax()) {
         $id = Input::get('id');
         $flightId = Input::get('flightId');
         $flightName = Input::get('flightName');
         $adId = Input::get('adId');
         $status = TRUE;
         $view = NULL;
         $this->data['flightId'] = $flightId;
         $this->data['flightName'] = $flightName;
         $this->data['adId'] = $adId;
         $this->data['id'] = $id;
         // check if flightPublisher exist
         $flightAd = AdFlightAdvertiserManagerModel::where('ad_id', $adId)->where('flight_id', $flightId)->first();
         if ($id != 0 && $flightAd) {
             $this->data['data'] = $flightAd;
         }
         $view = View::make('flightModal', $this->data)->render();
         return Response::json(array('status' => $status, 'view' => $view));
     }
 }