Пример #1
0
 /**
  * Destroy the given movie.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \App\Movie  $movie
  * @return Response
  */
 public function destroy(Request $request, Movie $movie)
 {
     if ($movie->user->id !== $request->user()->id) {
         abort(403);
     }
     $movie->delete();
     event(new MovieDeleted($movie->id));
 }
 public function store(Request $request)
 {
     $nuevaPelicula = new Movie();
     $nuevaPelicula->imdb_id = $request->imdb_id;
     $nuevaPelicula->name = $request->name;
     $nuevaPelicula->save();
     $response = Response::make(json_encode(['data' => $nuevaPelicula]), 201);
     return $response;
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $movie = new Movie();
     $movie->title = $request->title;
     $movie->secondary_title = $request->secondary_title;
     $movie->favourite = $request->input('favourite', 0);
     $movie->watched = $request->input('watched', 0);
     $movie->format_id = $request->format;
     $movie->category_id = $request->category;
     $movie->save();
     return redirect('movie');
 }
Пример #4
0
 public function indexCinema()
 {
     $WatchedMovies = Movie::WatchedMovies()->whereNotNull('ticket_datetime')->orderBy('ticket_datetime', 'desc')->paginate(100);
     $title = 'Latest movies i have watched in the cinemas (with ticket).';
     $ticketsview = true;
     return view('pages.Movie.Watched', ['WatchedMovies' => $WatchedMovies, 'title' => $title, 'ticketsview' => $ticketsview]);
 }
    /**
     * Stores a new notification for the user.
     *
     * @param Request $request
     *
     * @return array
     */
    public function create(Request $request)
    {
        $validator = Validator::make($request->all(), [
            'gcm_id'   => 'required|exists:users,gcm_id',
            'movie_id' => 'required|exists:movies,id',
            'date'     => 'required|date|after:today',
            'no_of_seats' => 'required_with_all:after_time,before_time|integer',
            'after_time' => 'required_with_all:no_of_seats,before_time|date_format:g\:i A',
            'before_time' => 'required_with_all:no_of_seats,after_time|date_format:g\:i A',
        ]);

        if ($validator->fails()) {
            return ['errors' => $validator->errors()->all(), 'status' => 'failed'];
        }

        $user = User::whereGcmId($request->get('gcm_id'))->firstOrFail();
        $movie = Movie::findOrFail($request->get('movie_id'));
        $date = Carbon::createFromFormat('Y-m-d', $request->get('date'))->toDateString();
        $numberOfSeats = $request->get('no_of_seats', 0);
        $afterTime = $numberOfSeats ? $request->get('after_time') : null;
        $beforeTime = $numberOfSeats ? $request->get('before_time') : null;

        if (!$movie->showtimes()->where('date', $date)->count()) {
            $user->notifications()->firstOrCreate([
                'movie_id' => $movie->id,
                'date'     => Carbon::createFromFormat('Y-m-d', $date)->toDateTimeString(),
                'sent'     => false,
                'no_of_seats' => $numberOfSeats,
                'after_time' => $afterTime,
                'before_time' => $beforeTime,
            ]);
        }

        return ['status' => 'success'];
    }
Пример #6
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     // load the last x added items from movies-table
     $movies = Movie::all()->sortByDesc('created_at')->take(7);
     //return the home-view with $movies-data
     return view('home', compact('movies'));
 }
Пример #7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create('en_GB');
     for ($i = 0; $i < 50; $i++) {
         \App\Movie::create(['title' => $faker->firstName, 'year' => $faker->date('Y')]);
     }
 }
 public function query(Request $request)
 {
     $q = $request->input('q');
     $results["q"] = $q;
     $results["movies"] = Movie::where('name', 'like', '%' . $q . '%')->with('casts')->get();
     $results["casts"] = Cast::where('name', 'like', '%' . $q . '%')->with('movies')->get();
     //        return view('results', ['results' => $results]);
     return $results;
 }
Пример #9
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function voteDown($id, Request $request)
 {
     $rating = new MovieRating();
     $rating->movie_id = $id;
     $rating->rating = -1;
     $rating->save();
     $movie = Movie::findOrFail($id);
     return response()->json(['success' => true, 'score' => $movie->rating]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $movies = Movie::lists('id')->all();
     $collections = Collection::lists('id')->all();
     $limit = 20;
     for ($i = 0; $i < $limit; $i++) {
         DB::table('collection_movie')->insert(['collection_id' => $faker->randomElement($collections), 'movie_id' => $faker->randomElement($movies)]);
     }
 }
 function index()
 {
     $movies = \App\Movie::all();
     // echo '<pre>';
     // print_r($movies);
     // echo '</pre>';
     // $dictionary = [ 'cat' => 'my lovable annoying pet', 'dog' => 'one which loves walks' ];
     // echo $dictionary['cat'];
     return view('movies.index', ['all_movies' => $movies]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $movies = Movie::lists('id')->all();
     $genres = Genre::lists('id')->all();
     $limit = 20;
     for ($i = 0; $i < $limit; $i++) {
         DB::table('movie_genre')->insert(['movie_id' => $faker->randomElement($movies), 'genre_id' => $faker->randomElement($genres)]);
     }
 }
 public function query(Request $request)
 {
     $q = $request->input('q');
     $results["q"] = $q;
     $results["movies"] = [];
     $results["casts"] = [];
     if (!strcmp($q, "")) {
         return $results;
     }
     $results["movies"] = Movie::where('name', 'like', '%' . $q . '%')->take(3)->get();
     $results["casts"] = Cast::where('name', 'like', '%' . $q . '%')->take(3)->get();
     return $results;
 }
Пример #14
0
 public function show($slug)
 {
     $movie = Movie::where('slug', $slug)->first();
     if (!$movie) {
         abort(404, 'Movie do not exists, either i messed up or you write poorly');
     }
     $genrerow = '';
     foreach ($movie->genres as $genre) {
         $genrerow .= ucfirst($genre) . ', ';
     }
     $genrerow = rtrim($genrerow, ', ');
     return view('pages.Movie.Movie', ['movie' => $movie, 'genrerow' => $genrerow]);
 }
Пример #15
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $today = date('Y-m-d');
     $showtimes = Showtime::where('date', '<', $today)->with('movie')->get();
     foreach ($showtimes as $showtime) {
         $this->removeOldNotifications($showtime);
         $showtime->delete();
     }
     $movies = Movie::where('release_date', '<', $today)->get();
     foreach ($movies as $movie) {
         $this->removeIfHasNoLongerShowTimes($movie);
     }
 }
 public function show($serieId)
 {
     $serieBD = Serie::findOrFail($serieId);
     $output = \Tmdb::getSearchApi()->searchCollection($serieBD->title, array('language' => 'fr'));
     $serie = $output['results'][0];
     $moviesBD = Movie::collectionMovie($serieBD['id']);
     foreach ($moviesBD as $movie) {
         $array = \Tmdb::getMoviesApi()->getMovie($movie->tmdb_id, array('language' => 'fr'));
         $array['movieBdId'] = $movie['id'];
         $movies[] = $array;
     }
     $serie['bdId'] = $serieBD['id'];
     return view('serie.show', compact('serie', 'movies'));
 }
 function index()
 {
     //$movies=\App\Movie::where('title','=','summertime')->get();
     //$movies=\App\Movie::where('rating','>',2)->get(); //select * from movies where rating > 2
     //return $movies;
     //$movie=new \App\Movie();
     //$movie->title='Akirachix';
     //$movie->genre='awesome';
     //$movie->rating=5;
     //$movie->save();
     //return $movie;
     $movies = \App\Movie::all();
     return view('movies', ['movies' => $movies]);
 }
Пример #18
0
 public function viewUpdate($id)
 {
     // Set logged in user into a variable.
     $user = Auth::user();
     // Find the userlist with the passed through Id
     // That belongs to the logged in user
     // And set into a variable.
     $userlist = Userlist::where('user_id', '=', $user->id)->findOrFail($id);
     // Find all movies belonging to the logged in user
     // And set into variable.
     $movies = Movie::where('user_id', '=', $user->id)->orderBy('title', 'asc')->get();
     // Return userlist update view with userlists variable.
     return view('userlists.viewUpdate')->with('userlist', $userlist)->with('movies', $movies);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     $movies = \App\Movie::all();
     $casts = \App\Cast::all();
     foreach ($movies as $movie) {
         foreach ($casts as $cast) {
             if (random_int(0, 1) == 1) {
                 $cm = new \App\Cast_Movie();
                 $cm->movie_id = $movie->id;
                 $cm->cast_id = $cast->id;
                 $cm->save();
             }
         }
     }
 }
 /**
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function index()
 {
     $TicketsTotal = Movie::select(DB::raw('SUM(ticket_price) as TotalCost, AVG(ticket_price) as AverageCostPerTicketInclFree, AVG(CASE WHEN ticket_price > 0 THEN ticket_price ELSE NULL END) AS AverageCostPerTicketExclFree, COUNT(ticket_datetime) as TotalTickets, COUNT(CASE WHEN ticket_price = 0 THEN 1 ELSE NULL END) AS NumberOfFreeTickets, COUNT(CASE WHEN ticket_price = 0 THEN NULL ELSE 1 END) AS NumberOfNotFreeTickets'))->whereNotNull('ticket_datetime')->get();
     $AverageTicketPricePerYear = Movie::select(DB::raw('DATE_FORMAT(ticket_datetime, \'%Y-01-01 00:00:00\') AS Year, AVG(ticket_price) as AverageCostPerTicketInclFree, AVG(CASE WHEN ticket_price > 0 THEN ticket_price ELSE NULL END) AS AverageCostPerTicketExclFree'))->whereNotNull('ticket_datetime')->groupby(DB::raw('YEAR(ticket_datetime)'))->orderby(DB::raw('YEAR(ticket_datetime)'))->get();
     $LineChartAverageTicketPricePerYear = $this->getLineChartAverageTicketPricePerYear($AverageTicketPricePerYear);
     $NumberOfTicketsPerYear = Movie::select(DB::raw('DATE_FORMAT(ticket_datetime, \'%Y-01-01 00:00:00\') AS Year, COUNT(CASE WHEN ticket_price = 0 THEN 1 ELSE NULL END) AS NumberOfFreeTickets, COUNT(CASE WHEN ticket_price = 0 THEN NULL ELSE 1 END) AS NumberOfNotFreeTickets'))->whereNotNull('ticket_datetime')->groupby(DB::raw('YEAR(ticket_datetime)'))->orderby(DB::raw('YEAR(ticket_datetime)'))->get();
     $BarChartNumberOfTicketsPerYear = $this->getBarChartNumberOfTicketsPerYear($NumberOfTicketsPerYear->transform(function (Movie $item) {
         if ($item->NumberOfNotFreeTickets == 0) {
             $item->NumberOfNotFreeTickets = null;
         }
         if ($item->NumberOfFreeTickets == 0) {
             $item->NumberOfFreeTickets = null;
         }
         return $item;
     }));
     $TotalCostPerYear = Movie::select(DB::raw('DATE_FORMAT(ticket_datetime, \'%Y-01-01 00:00:00\') AS Year, SUM(ticket_price) as TotalCost'))->whereNotNull('ticket_datetime')->groupby(DB::raw('YEAR(ticket_datetime)'))->orderby(DB::raw('YEAR(ticket_datetime)'))->get();
     $LineTotalCostPerYear = $this->getLineTotalCostPerYear($TotalCostPerYear);
     return view('pages.Movie.ticketstats', ['TicketsTotal' => $TicketsTotal[0], 'LineChartAverageTicketPricePerYear' => $LineChartAverageTicketPricePerYear, 'BarChartNumberOfTicketsPerYear' => $BarChartNumberOfTicketsPerYear, 'LineTotalCostPerYear' => $LineTotalCostPerYear]);
 }
Пример #21
0
 public function run()
 {
     //DB::table('movies')->delete();
     // ditsol
     Movie::create(array('movie_title' => 'Dancing in the Shadow of Love', 'synopsis' => 'a Tutu Demosthene Film', 'stream_period' => '72', 'release_year' => '2015', 'genre' => 'Drama', 'language' => 'English', 'subtitles' => 'None', 'rating' => 'R', 'runtime' => 85, 'writers' => 'Tutu Demosthene', 'directors' => 'Tutu Demosthene', 'actors' => 'Tony Delerme, Blondedy Ferdinand', 'rent' => 2.99, 'buy' => 7.99, 'pay_link' => 'http://meateater.vhx.tv/buy/volume-9-ep-1-sky-island-solitaire-backpack-hunting-coues-deer-in-arizona', 'featured' => '1', 'published' => '1', 'poster' => 'images/posters/ditsol.jpg', 'trailer' => '<iframe width="1280" height="720" src="https://www.youtube.com/embed/5tVsM2YUBsM" frameborder="0" allowfullscreen></iframe>', 'slug' => 'dancing-in-the-shadow-of-love'));
     // assassin
     Movie::create(array('movie_title' => 'The Birth of an Assassin', 'synopsis' => 'The most anticipated Haitian movie of the year', 'stream_period' => '48', 'release_year' => '2011', 'genre' => 'Action', 'language' => 'English', 'subtitles' => 'Creole', 'rating' => 'R', 'runtime' => 120, 'writers' => 'Tutu Demosthene', 'directors' => 'Tutu Demosthene', 'actors' => 'Tico Armand, Tony Delerme, Sheila Mocombre', 'rent' => 2.99, 'buy' => 7.99, 'pay_link' => 'http://meateater.vhx.tv/buy/volume-9-ep-1-sky-island-solitaire-backpack-hunting-coues-deer-in-arizona', 'featured' => '0', 'published' => '1', 'poster' => 'images/posters/assassin.jpg', 'trailer' => '<iframe src="https://embed.vhx.tv/packages/9742" width="745" height="419" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>', 'slug' => 'the-birth-of-an-assassing'));
     // private nurse
     Movie::create(array('movie_title' => 'Private Nurse', 'synopsis' => 'Marcus, a young playboy whose used to having his way with the woman thinks he hit the jackpot when sways a seemingly naive nurse off her feet. She is not your run of the mill nurse though. Her thirst for money is greater then his and before Marcus knows it he plays into her trap. He only set out to get taken care of, but Ms. nurse has bigger plans for him with her games of lies, deception and murder.', 'stream_period' => '72', 'release_year' => '2013', 'genre' => 'Drama', 'language' => 'English', 'subtitles' => 'Creole', 'rating' => 'R', 'runtime' => 120, 'writers' => 'Lisa Lafrance', 'directors' => 'Tony Delerme', 'actors' => 'Lisa Lafrance, Sheila Mocombre, Tony Delerme', 'rent' => 2.99, 'buy' => 7.99, 'pay_link' => 'http://meateater.vhx.tv/buy/volume-9-ep-1-sky-island-solitaire-backpack-hunting-coues-deer-in-arizona', 'featured' => '0', 'published' => '1', 'poster' => 'images/posters/no-poster.png', 'trailer' => '<iframe src="https://embed.vhx.tv/packages/9742" width="745" height="419" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>', 'slug' => 'private-nurse'));
     // we love you anne
     Movie::create(array('movie_title' => 'We Love You Anne', 'synopsis' => 'Anne falls in love once again in this new Richard Senegal-directed sequel.', 'stream_period' => '72', 'release_year' => '2014', 'genre' => 'Comedy', 'language' => 'Creole', 'subtitles' => 'N/A', 'rating' => 'PG', 'runtime' => 120, 'writers' => 'Richard Senegal', 'directors' => 'Richard Senegal', 'actors' => 'Nice Simon, Don Kato, Gessica Geneus, Tonton Bicha', 'rent' => 2.99, 'buy' => 7.99, 'pay_link' => 'http://meateater.vhx.tv/buy/volume-9-ep-1-sky-island-solitaire-backpack-hunting-coues-deer-in-arizona', 'featured' => '0', 'published' => '1', 'poster' => 'images/posters/no-poster.png', 'trailer' => '<iframe width="1280" height="720" src="https://www.youtube.com/embed/oKmBbGwLdTI?rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>', 'slug' => 'we-love-you-anne'));
     // le sacrifice de l'amour
     Movie::create(array('movie_title' => 'Le Sacrifice de L\'amour', 'synopsis' => 'Ashley (Leonie Clerfius), a beautiful church girl find herself in love with a handsome non-Christian man, but Jacob (Ronald Tima) who is a real Christian brother doesn’t see any body else to be with but Ashley. Unfortunately, Ashley doesn\'t have any feelings for Jacob. Some of you may have been abused physically, mentally, and emotionally in a relationship, but you wonder if you will ever fall in love again after all you have been through?', 'stream_period' => '72', 'release_year' => '2013', 'genre' => 'Drama', 'language' => 'Creole', 'subtitles' => 'English', 'rating' => 'R', 'runtime' => 120, 'writers' => 'Ronald Tima', 'directors' => 'Ronald Tima', 'actors' => 'Claude Alain Brisson, Leonie Clerfius, Ronald Tima, Woodler Alezy', 'rent' => 2.99, 'buy' => 7.99, 'pay_link' => 'http://meateater.vhx.tv/buy/volume-9-ep-1-sky-island-solitaire-backpack-hunting-coues-deer-in-arizona', 'featured' => '0', 'published' => '0', 'poster' => 'images/posters/no-poster.png', 'trailer' => '<iframe width="1280" height="720" src="https://www.youtube.com/embed/S4xeHP4GFls?rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>', 'slug' => 'le-sacrifice-de-lamour'));
     // unconditional love
     Movie::create(array('movie_title' => 'Unconditional Love', 'synopsis' => 'Jesula is the apple of her mother\'s eyes. Her mother, abandoned by family and friends, struggles for 18 years to put her through school, and to provide her with a decent life with the hope that Jesula will keep the promise of assuring a better future for her, and to make everyone acknowledge her with dignity and respect. What happens when life takes a different turn? Does Jesula keep her promise to her mother? Or does she let arrogance take the best of her and forgets her background? Be prepared to take a journey as you experience all aspects of true love through \'Unconditional Love\'.', 'stream_period' => '48', 'release_year' => '2014', 'genre' => 'Drama', 'language' => 'English', 'subtitles' => 'English', 'rating' => 'R', 'runtime' => 120, 'writers' => 'Anne Joseph', 'directors' => 'Hans Patrick Domercant', 'actors' => 'Reginald Lubin, Betty Lemite, Anne Joseph', 'rent' => 2.99, 'buy' => 7.99, 'pay_link' => 'http://meateater.vhx.tv/buy/volume-9-ep-1-sky-island-solitaire-backpack-hunting-coues-deer-in-arizona', 'featured' => '1', 'published' => '1', 'poster' => 'images/posters/no-poster.png', 'trailer' => '<iframe src="https://player.vimeo.com/video/60270822?title=0&byline=0&portrait=0" width="800" height="450" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>', 'slug' => 'unconditional-love'));
     // un monde separe
     Movie::create(array('movie_title' => 'Un Monde Séparé', 'synopsis' => 'Jesula is the apple of her mother\'s eyes. Her mother, abandoned by family and friends, struggles for 18 years to put her through school, and to provide her with a decent life with the hope that Jesula will keep the promise of assuring a better future for her, and to make everyone acknowledge her with dignity and respect. What happens when life takes a different turn? Does Jesula keep her promise to her mother? Or does she let arrogance take the best of her and forgets her background? Be prepared to take a journey as you experience all aspects of true love through \'Unconditional Love\'.', 'stream_period' => '72', 'release_year' => '2013', 'genre' => 'Drama', 'language' => 'Creole', 'subtitles' => 'English', 'rating' => 'PG-13', 'runtime' => 110, 'writers' => 'Jean E. Fenton', 'directors' => 'Saintanor S. Camilus', 'actors' => 'Jean Gardy Bien-Aime, Jean Claude Guillaume, Jessica H. Donette, Shirly Dorilas, Williams Germain, Oz\'mosis, Sly-One, Ruthiana M. Cenatus.', 'rent' => 1.99, 'buy' => 7.99, 'pay_link' => 'http://meateater.vhx.tv/buy/volume-9-ep-1-sky-island-solitaire-backpack-hunting-coues-deer-in-arizona', 'featured' => '1', 'published' => '1', 'poster' => 'images/posters/no-poster.png', 'trailer' => '<iframe width="1280" height="720" src="https://www.youtube.com/embed/ClywmVzDe0M?rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>', 'slug' => 'un-monde-separe'));
     // everybody cheats
     Movie::create(array('movie_title' => 'Everybody Cheats', 'synopsis' => 'Ricky and Shirley have problems. Their love is untested and taken for granted. Is she looking for someone else to ignite her passion? Their "perfect couple" friends, Ted and Hellen seem to think so. But nobody\'s perfect. Are they?. Ricky\'s boss Vonsky completely trusted his fiancee, maybe not such a good idea. Vonsky\'s uncle Harry has a good marriage, but when it comes to money he has to finagle. Patricia always plays the field can she stop toying with men and find true love. Francesca is true to her work at the orphanage, though the men in her life want her for themselves. To make things work, everybody cheats. Or do they?', 'stream_period' => '72', 'release_year' => '2013', 'genre' => 'Drama', 'language' => 'English', 'subtitles' => 'English', 'rating' => 'R', 'runtime' => 130, 'writers' => 'Richard Widmack Belot', 'directors' => 'Richard Widmack Belot', 'actors' => 'Benz Antoine, Betty Lemite, Daniel Davis, Evelyn Gonzales, Evenflow Guillomaitre, Miguel Lopes, Richard Widmack Belot, Sarodj Bertin, Scott Neufville', 'rent' => 2.99, 'buy' => 7.99, 'pay_link' => 'http://meateater.vhx.tv/buy/volume-9-ep-1-sky-island-solitaire-backpack-hunting-coues-deer-in-arizona', 'featured' => '1', 'published' => '1', 'poster' => 'images/posters/no-poster.png', 'trailer' => '<iframe src="https://player.vimeo.com/video/60270822?title=0&byline=0&portrait=0" width="800" height="450" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>', 'slug' => 'everybody-cheats'));
 }
 /**
  * @param Request $request
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(Request $request)
 {
     $input = $request->all();
     $movie = Movie::where('slug', $input['slug'])->first();
     $movie->ticket_datetime = $input['ticket_datetime'] . ':00';
     $movie->ticket_price = $input['ticket_price'];
     $movie->ticket_row = $input['ticket_row'];
     $movie->ticket_seat = $input['ticket_seat'];
     $destinationFile = $input['slug'] . '.png';
     if (env('APP_ENV', false) == 'local') {
         $destinationPath = public_path('img\\tickets\\' . $input['year'] . '\\');
     } else {
         $destinationPath = public_path('img/tickets/' . $input['year'] . '/');
     }
     if (!is_dir($destinationPath)) {
         mkdir($destinationPath, 0777, true);
     }
     file_put_contents($destinationPath . $destinationFile, file_get_contents($input['ticket_image']));
     $test = getimagesize($destinationPath . $destinationFile);
     if ($test[0] > 10) {
         $movie->save();
     }
     return redirect()->action('Admin\\MovieTicketsAdminController@index');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $movie = Movie::findOrFail($id);
     $movie->delete();
     return redirect()->route('movies.index')->with('message', 'Item deleted successfully.');
 }
Пример #24
0
 private function storeMovie($watchedMovie)
 {
     $movie = Movie::firstOrNew(['id_trakt' => $watchedMovie->movie->ids->trakt]);
     if (!empty($watchedMovie->plays)) {
         $movie->plays = $watchedMovie->plays;
     }
     if (!empty($watchedMovie->watched_at)) {
         $last_watched_at = new Carbon($watchedMovie->watched_at);
         $last_watched_at->timezone = new \DateTimeZone(config('app.timezone'));
         $movie->last_watched_at = $last_watched_at;
     } elseif (!empty($watchedMovie->last_watched_at)) {
         $last_watched_at = new Carbon($watchedMovie->last_watched_at);
         $last_watched_at->timezone = new \DateTimeZone(config('app.timezone'));
         $movie->last_watched_at = $last_watched_at;
     }
     $movie->title = $watchedMovie->movie->title;
     $movie->year = $watchedMovie->movie->year;
     $movie->slug = $watchedMovie->movie->ids->slug;
     $movie->id_imdb = $watchedMovie->movie->ids->imdb;
     $movie->id_tmdb = $watchedMovie->movie->ids->tmdb;
     $movie->tagline = $watchedMovie->movie->tagline;
     $movie->overview = $watchedMovie->movie->overview;
     $movie->released = $watchedMovie->movie->released;
     $movie->runtime = $watchedMovie->movie->runtime;
     $movie->trailer = $watchedMovie->movie->trailer;
     $movie->homepage = $watchedMovie->movie->homepage;
     $movie->trakt_updated_at = new Carbon($watchedMovie->movie->updated_at);
     $movie->certification = $watchedMovie->movie->certification;
     $movie->fanart = $watchedMovie->movie->images->fanart->full;
     $movie->poster = $watchedMovie->movie->images->poster->full;
     $movie->logo = $watchedMovie->movie->images->logo->full;
     $movie->clearart = $watchedMovie->movie->images->clearart->full;
     $movie->banner = $watchedMovie->movie->images->banner->full;
     $movie->thumb = $watchedMovie->movie->images->thumb->full;
     $movie->genres = $watchedMovie->movie->genres;
     return $movie->save();
 }
Пример #25
0
 public function handle()
 {
     return Movie::create(['name' => $this->name, 'category_id' => $this->category_id, 'director' => $this->director, 'genre' => $this->genre, 'synopsis' => $this->synopsis, 'price' => $this->price, 'main_image' => $this->main_image, '_image1' => $this->image1, '_image2' => $this->image2, '_image3' => $this->image3, 'quantity' => $this->quantity]);
 }
Пример #26
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     Movie::create($request->all());
     return redirect()->action('MainController@index');
 }
Пример #27
0
 /**
  * Get the data to broadcast.
  *
  * @return array
  */
 public function broadcastWith()
 {
     return ['movie' => $this->movie->load('user')];
 }
Пример #28
0
 public function handle()
 {
     return Movie::where('id', $this->id)->delete();
 }
 /**
  * Save a new article.
  *
  * @param TorrentRequest $request
  *
  * @return mixed
  */
 private function createTorrent(TorrentRequest $request)
 {
     $collection = \Tmdb::getMoviesApi()->getMovie($request->input('tmdb_id'))['belongs_to_collection'];
     if ($collection['name'] != null) {
         $serie = Serie::firstOrCreate(['title' => $collection['name'], 'tmdb_id' => $collection['id']]);
     } else {
         $serie['id'] = 0;
     }
     $movie = Movie::firstOrCreate(['serie_id' => $serie['id'], 'title' => $request->input('title'), 'tmdb_id' => $request->input('tmdb_id')]);
     $request->request->add(['movie_id' => $movie->id, 'serie_id' => $serie['id']]);
     $torrent = Auth::user()->torrents()->create($request->all());
     $this->syncTags($movie, $request->input('tag_list'));
     return $torrent;
 }
Пример #30
0
Route::get('/', function () {
    return view('welcome');
});
Route::get('/about', function () {
    return view('about');
});
Route::get('/movies', function () {
    //$movies = \App\Movie::where('title','=','shuga')->get();
    $movies = \App\Movie::where('rating', '>', 2)->get();
    return $movies;
    $movie = \App\Movie();
    $movie->title = 'Spiderman';
    $movie->genre = 'spiders';
    $movie->rating = 3;
    $movie->save();
    return \App\Movie::all();
});
//Route::get('/movies','MoviesController@index');
//Route::get('/movies', function () {
//$Movies = \App\Movie::where('title','=','shuga')->get();
//$Movies = \App\movie::where('rating','>'2)->get(); //select * from movies where rating > 2
//return $movies;
//$movie= new \App\Movie();
//$Movie->title='Akirachix';
//$movie->genre='awesome';
//$movie->rating=5;
//$movie->save();
// $movie= \App\Movie::find(5);
// $movie->genre='Horror';
// $movie->rating=4;
// $movie->save();