public function run()
 {
     DB::table('movies')->delete();
     Movie::create(array('title' => 'Man of steel', 'releaseDate' => date('2013-06-19'), 'genre' => 'Fantasy', 'synopsis' => 'A young journalist is forced to confront his secret extraterrestrial heritage when Earth is invaded by members of his race.', 'poster' => 'http://ia.media-imdb.com/images/M/MV5BMjI5OTYzNjI0Ml5BMl5BanBnXkFtZTcwMzM1NDA1OQ@@._V1_SY317_CR1,0,214,317_.jpg'));
     Movie::create(array('title' => 'Star Trek Into Darkness', 'releaseDate' => date('2013-06-12'), 'genre' => 'Fantasy', 'synopsis' => 'After the crew of the Enterprise find an unstoppable force of terror from within their own organization, Captain Kirk leads a manhunt to a war-zone world to capture a one man weapon of mass destruction.', 'poster' => 'http://ia.media-imdb.com/images/M/MV5BMTk2NzczOTgxNF5BMl5BanBnXkFtZTcwODQ5ODczOQ@@._V1_SX214_.jpg'));
     Movie::create(array('title' => 'Monstres Academy', 'releaseDate' => date('2013-07-10'), 'genre' => 'Animation', 'synopsis' => "A look at the relationship between Mike and Sulley during their days at Monsters University -- when they weren't necessarily the best of friends.", 'poster' => 'http://ia.media-imdb.com/images/M/MV5BMTUyODgwMDU3M15BMl5BanBnXkFtZTcwOTM4MjcxOQ@@._V1_SX214_.jpg'));
 }
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 20) as $index) {
         Movie::create(['title' => $faker->sentence(), 'year' => $faker->year($max = 'now'), 'poster_url' => str_replace('public', '', $faker->image($dir = 'public/img', $width = 125, $height = 200)), 'description' => $faker->paragraph(2), 'director' => $faker->name(), 'stars' => $faker->name() . ', ' . $faker->name(), 'note' => $faker->numberBetween($min = 0, $max = 5), 'genre' => $faker->sentence(1), 'watched' => $faker->boolean($chanceOfGettingTrue = 30)]);
     }
 }
Ejemplo n.º 3
0
 /**
  * This function create movie
  * when data is posted from 
  * /admin/movie/create
  */
 public function postCreate()
 {
     // Check validation
     $validator = Validator::make(Input::all(), Movie::$rulesForCreate);
     // If failed then redirect to movie-create-get route with
     // validation error and input old
     if ($validator->fails()) {
         return Redirect::route('movie-create-get')->withErrors($validator)->withInput();
     }
     Movie::create(array('name' => Input::get('name'), 'actor' => Input::get('actor'), 'director' => Input::get('director'), 'category_id' => Input::get('category_id'), 'main_language' => Input::get('main_language'), 'number_of_discs' => Input::get('number_of_discs'), 'series' => Input::get('series'), 'run_time' => Input::get('run_time'), 'release_year' => Input::get('release_year')));
     return View::make('adminArea.movie.create')->with('success', 'Movie has been created successfully');
 }
Ejemplo n.º 4
0
 public function doInsert()
 {
     global $baseDir;
     $movies_array = JSONParser::parseJSON($baseDir . '\\mysite\\inTheatre.json');
     //9 items
     for ($i = 0; $i < count($movies_array); $i++) {
         $movie = Movie::create();
         $movie = $movies_array[$i];
         $movie->MovieListPageID = $this->ID;
         $movie->write();
     }
     return $this->redirectBack();
 }
Ejemplo n.º 5
0
 public static function parseJSON($url)
 {
     $data = file_get_contents($url);
     $de_json = json_decode($data, TRUE);
     $count_json = count($de_json);
     //3 Objects
     $movies = $de_json[0]['movies'];
     $count_movies = count($movies);
     $movies_array = array();
     for ($i = 0; $i < $count_movies; $i++) {
         $movie_json = $movies[$i];
         $Title = $movie_json['title'];
         $Countries = implode(', ', $movie_json['countries']);
         $Locations = implode(', ', $movie_json['filmingLocations']);
         $Genres = implode(', ', $movie_json['genres']);
         $Languages = implode(', ', $movie_json['languages']);
         $Metascore = $movie_json['metascore'];
         $Rated = $movie_json['rated'];
         $Runtime = implode(', ', $movie_json['runtime']);
         $Directors = $movie_json['directors'][0]['name'];
         $Rating = $movie_json['rating'];
         $Plot = $movie_json['plot'];
         $SimplePlot = $movie_json['simplePlot'];
         $WritersArray = $movie_json['writers'];
         $writers_array = array();
         foreach ($WritersArray as $Writer) {
             array_push($writers_array, $Writer['name']);
         }
         $Writers = implode(', ', $writers_array);
         $UrlPoster = $movie_json['urlPoster'];
         $movie = Movie::create();
         $movie->Title = $Title;
         $movie->Countries = $Countries;
         $movie->Locations = $Locations;
         $movie->Genres = $Genres;
         $movie->Languages = $Languages;
         $movie->Metascore = $Metascore;
         $movie->Rated = $Rated;
         $movie->Runtime = $Runtime;
         $movie->Directors = $Directors;
         $movie->Rating = $Rating;
         $movie->Plot = $Plot;
         $movie->SimplePlot = $SimplePlot;
         $movie->Writers = $Writers;
         $movie->UrlPoster = $UrlPoster;
         array_push($movies_array, $movie);
     }
     //var_dump(Movie::custom_database_fields('Movie'));
     //var_dump($movie_json['countries'][0]);
     return $movies_array;
 }
Ejemplo n.º 6
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     /*
     $movie              = new Movie();
     
     $movie->title       = Input::get('movie_title'); 
     $movie->year        = Input::get('movie_year');
     $movie->description = Input::get('movie_description');
     $movie->director    = Input::get('movie_director');
     //$movie->stars       = Input::get('movie_stars');
     $movie->genre       = Input::get('movie_genre');
     
     // Poster
     $img                = Input::file('movie_poster');		
     $filename           = $img->getClientOriginalName();		
     $movie->poster_url  = $filename;
     */
     // omdb url pattern
     // http://ia.media-imdb.com/images/M/MV5BMTc5OTk4MTM3M15BMl5BanBnXkFtZTgwODcxNjg3MDE@._V1_SX300.jpg
     $omdb_poster_url = Input::get('Poster');
     // retrieve filename
     $url_array = explode('/', $omdb_poster_url);
     $url_array_count = count($url_array);
     $filename = $url_array[$url_array_count - 1];
     // seperate name / extension
     $filename_array = explode('.', $filename);
     $filename_array_count = count($filename_array);
     $name = sha1($filename_array[0]);
     $ext = $filename_array[$filename_array_count - 1];
     // poster_url
     $path_img_dir = '/img/';
     $poster_url = $path_img_dir . $name . '.' . $ext;
     // save it
     $destinationPath = public_path() . $poster_url;
     file_put_contents($destinationPath, file_get_contents($omdb_poster_url));
     Movie::create(array('title' => Input::get('Title'), 'year' => Input::get('Year'), 'poster_url' => $poster_url, 'description' => Input::get('Plot'), 'director' => Input::get('Director'), 'stars' => Input::get('Actors'), 'genre' => Input::get('Genre')));
     return Response::json(array('success' => true));
 }