Ejemplo n.º 1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $cinema = Cinemas::findOrFail($id);
     $cinemas->delete();
     \Session::flash('message', 'Cinema "' . $cinemas->Name . '" has been Deleted');
     return redirect()->route('cinemas.index');
 }
Ejemplo n.º 2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $cinemas = Cinemas::lists('Name', 'id');
     $movies = Movies::lists('Title', 'id');
     $sessions = SessionTimes::findOrFail($id);
     return view('sessions.edit', compact('sessions'))->with('cinemas', $cinemas)->with('movies', $movies);
 }
Ejemplo n.º 3
0
 public function run()
 {
     Cinemas::create(['name' => 'Ritz Randwick', 'address' => '45 St Pauls Street, Randwick NSW 2031', 'geo' => json_encode(array("lat" => "", "lang" => ""))]);
     Cinemas::create(['name' => 'Dendy Newtown', 'address' => '261-263 King Street, Newtown NSW 2042', 'geo' => json_encode(array("lat" => "", "lang" => ""))]);
     Cinemas::create(['name' => 'Dendy Opera Quay', 'address' => 'Shop9, 2 East Circular Quay, Sydney NSW 2000', 'geo' => json_encode(array("lat" => "", "lang" => ""))]);
     Cinemas::create(['name' => 'Palace Norton Street', 'address' => '99 Norton Street, Leichhardt NSW 2040', 'geo' => json_encode(array("lat" => "", "lang" => ""))]);
     Cinemas::create(['name' => 'Palace Verona', 'address' => '17 Oxford Street, Paddington', 'geo' => json_encode(array("lat" => "", "lang" => ""))]);
 }
Ejemplo n.º 4
0
 public static function store(array $cinema)
 {
     $cinema = array_only($cinema, array('id', 'title', 'cityId', 'address'));
     $cinema['city_id'] = $cinema['cityId'];
     unset($cinema['cityId']);
     $cinemas = Cinemas::firstOrNew($cinema);
     $cinemas->save();
 }
Ejemplo n.º 5
0
 /**
  * Get a JSON Cinema instance by the specified id
  *
  * @return Response
  */
 public function get($id)
 {
     //
     $cinema = Cinemas::find($id);
     if (!$cinema) {
         return response()->json(['message' => 'Could not find cinema specified', 'code' => 404], 404);
     }
     return response()->json(['data' => $cinema], 200);
 }
Ejemplo n.º 6
0
 public static function store(array $cinema)
 {
     $cinema = array_only($cinema, array('id', 'title', 'cityId', 'address', 'location'));
     $cinema['city_id'] = $cinema['cityId'];
     unset($cinema['cityId']);
     $cinema['longitude'] = $cinema['location']['longitude'];
     $cinema['latitude'] = $cinema['location']['latitude'];
     unset($cinema['location']);
     $cinemas = Cinemas::firstOrNew(array('id' => $cinema['id']));
     $cinemas->save();
     $cinemas->update($cinema);
 }
Ejemplo n.º 7
0
 public function getCinemaInfo($id)
 {
     $cinema = Cinemas::find($id);
     return view()->make('search.cinema', ['cinema' => $cinema]);
 }
Ejemplo n.º 8
0
 public static function getDynamicValues($type)
 {
     ini_set('memory_limit', '512M');
     ini_set("max_execution_time", "600");
     $file = public_path("upload/Tmp" . $type . ".json.gz");
     if ($type == "Cinemas") {
         $link = "https://api.kinohod.ru/api/data/1/eed7c723-0b90-3fc9-a3bc-bf235e907b35/cinemas.json.gz";
     } elseif ($type == "Seances") {
         $link = "https://api.kinohod.ru/api/data/1/eed7c723-0b90-3fc9-a3bc-bf235e907b35/seances/week.json.gz";
     } else {
         $link = "https://api.kinohod.ru/api/data/1/eed7c723-0b90-3fc9-a3bc-bf235e907b35/running/week.json.gz";
     }
     //dd($link);
     file_put_contents($file, fopen($link, 'r'));
     $fp = gzopen($file, "r");
     if ($fp != false) {
         $contents = gzread($fp, 134217720);
         $jsonArray = json_decode($contents, true);
         foreach ($jsonArray as $key => $value) {
             if ($type == "Cinemas") {
                 Cinemas::store($value);
             } elseif ($type == "Seances") {
                 Seances::store($value);
             } else {
                 Movies::store($value);
             }
         }
         gzclose($fp);
         unlink($file);
     } else {
         echo "404 not found";
     }
 }