Esempio n. 1
0
 function controller_festival($args, $output = "inline")
 {
     if (!empty($args["say"])) {
         $festival = new Festival();
         $festival->Say($args["say"]);
     }
     return $this->GetTemplate("./festival.tpl", $vars);
 }
 public function getFestival($user = null, $city = null)
 {
     try {
         $response = [];
         $statusCode = 200;
         $festival = Festival::all();
         if ($user != null) {
             $festival = Festival::where('user_id', $user)->get();
         } elseif ($city != null) {
             $festival = Festival::where('city_id', $city)->get();
         } elseif ($user != null && $city != null) {
             $festival = Festival::where('user_id', $user)->where('city_id', $city)->get();
         }
         foreach ($festival as $f) {
             $response[] = ['id' => $f->id, 'name' => $f->name];
         }
     } catch (Exception $e) {
         $statusCode = 404;
     } finally {
         return Response::json($response, $statusCode);
     }
 }