Пример #1
0
 public function uploadImage($placeId)
 {
     $place = Place::find($placeId);
     if (!$place) {
         return $this->errorNotFound('Place not found');
     }
     exit('This would normally upload an image somewhere but that is hard.');
 }
Пример #2
0
 public function show($id)
 {
     $place = Place::find($id);
     if (!$place) {
         return $this->errorNotFound('Did you just invent an ID and try loading a place? Muppet.');
     }
     return $this->respondWithItem($place, new PlaceTransformer());
 }
Пример #3
0
 public function getSelectPlaces()
 {
     $placeModels = Place::find();
     $places = [0 => 'Немає'];
     foreach ($placeModels as $place) {
         $places[$place->id] = $place->name;
     }
     return $places;
 }
Пример #4
0
 public function show($id)
 {
     $place = Place::find($id);
     return $this->respondWithItem($place, new PlaceTransformer());
 }
 /**
  * Show the form for editing the specified place.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $place = Place::find($id);
     return View::make('places.edit', compact('place'));
 }
Пример #6
0
 public function handleRequest()
 {
     // Fetch all the places:
     $places = Place::find();
     render('place', array('title' => 'Browsing places', 'places' => $places));
 }
Пример #7
0
 public function borrar_lugar()
 {
     $id = Input::get('idedit');
     $lugar = Place::find($id);
     if ($lugar->delete()) {
         Session::flash('message', 'Eliminado correctamente');
         Session::flash('class', 'success');
     } else {
         Session::flash('message', 'Ha ocurrido un error, intentelo nuevamente');
         Session::flash('class', 'danger');
     }
     return Redirect::to('lugar');
 }
Пример #8
0
    $param = json_decode($_POST["json"]);
    $placeDAO = new Place();
    $result = $placeDAO->getall($param);
    if (sizeof($result) > 0) {
        $result["success"] = true;
        echo json_encode($result);
    } else {
        $result["success"] = false;
        echo json_encode($result);
    }
});
$app->post('/place/find', function () {
    $request = \Slim\Slim::getInstance()->request();
    $param = json_decode($_POST["json"]);
    $placeDAO = new Place();
    $result = $placeDAO->find($param);
    if (sizeof($result) > 0) {
        $result["success"] = true;
        echo json_encode($result);
    } else {
        $result["success"] = false;
        echo json_encode($result);
    }
});
$app->post('/place/create', function () {
    $request = \Slim\Slim::getInstance()->request();
    $param = json_decode($_POST["json"]);
    $placeDAO = new Place();
    $result = $placeDAO->insert($param);
    echo '{"result":"ok"}';
    /*if(sizeof($result)>0){
Пример #9
0
 static function getMeetUpLocation($user1_id, $user2_id)
 {
     $query = $GLOBALS['DB']->query("SELECT location_id FROM meetups WHERE user1_id = {$user1_id} AND user2_id = {$user2_id} AND confirm_meet_usr1 IS NULL;");
     $result = $query->fetchAll(PDO::FETCH_ASSOC);
     $location_id = $result[0]['location_id'];
     $meetup_spot = Place::find($location_id);
     return $meetup_spot;
 }