public function AllocationProcess()
 {
     $VehicleData = Input::all();
     $validation = Validator::make($VehicleData, VehicleModel::$rules);
     if ($validation->passes()) {
         VehicleModel::create($VehicleData);
         return Redirect::to('allocation')->withErrors('Vehicle Details Saved Succesfully');
     } else {
         return Redirect::to('allocation')->withInput()->withErrors($validation->messages());
     }
 }
 function index()
 {
     $jsonReq = file_get_contents("php://input");
     $rfc = new JSON_RFC($jsonReq);
     //non check session here
     if ($rfc->rfc_object == "LoginService") {
         if (isset($rfc->rfc_data)) {
             if ($rfc->rfc_method == "doLogin") {
                 $this->loginService->setLogin($rfc->rfc_data);
                 $this->loginService->doLogin();
                 return;
             }
         }
     }
     //check security key, TODO:need public/private key here
     if ($this->loginService->isSessionKeyValid($rfc->rfc_session)) {
         //call method by using queryStringon URL
         if (isset($rfc->query_string)) {
             redirect($rfc->rfc_object . "/" . $rfc->rfc_method . $rfc->query_string . $rfc->rfc_session);
             return;
         } elseif (isset($rfc->rfc_data)) {
             if ($rfc->rfc_object == "VehicleModel") {
                 $obj = new VehicleModel();
                 if ($rfc->rfc_method == "add") {
                     $newdata = array('username' => 'johndoe', 'email' => '*****@*****.**', 'logged_in' => TRUE);
                     //$this->session->set_userdata($newdata);
                     //$session_id = $this->session->userdata('session_id');
                     //$_SESSION["johndoe"] = $session_id;
                     //echo $session_id;
                     $obj->add($rfc->rfc_data);
                 } elseif ($rfc->rfc_method == "insertModelVehicle") {
                     echo "OK";
                 }
             }
         }
     } else {
         echo "ANTHENTICATION FAIL!";
     }
 }