megacommit
This commit is contained in:
parent
2451ab45cb
commit
34ed81516b
51 changed files with 1200 additions and 251 deletions
19
app/Http/Controllers/Main/CinemaController.php
Normal file
19
app/Http/Controllers/Main/CinemaController.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Main;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CinemaController extends Controller
|
||||
{
|
||||
public function showAllCinemas()
|
||||
{
|
||||
return view('main.cinemas.index', ['title' => "Cinemas", 'cinemas' => \App\Models\Cinema::all()]);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
return view('main.cinemas.cinema', ['title' => "Cinema", 'cinema' => \App\Models\Cinema::findOrfail($id)]);
|
||||
}
|
||||
}
|
19
app/Http/Controllers/Main/GenreController.php
Normal file
19
app/Http/Controllers/Main/GenreController.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Main;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class GenreController extends Controller
|
||||
{
|
||||
public function show($id)
|
||||
{
|
||||
return view('main.genres.genre', ['title' => "Genre", 'genre' => \App\Models\Genre::findOrfail($id)]);
|
||||
}
|
||||
|
||||
public function showAllGenres()
|
||||
{
|
||||
return view('main.genres.index', ['title' => "Genres", 'genres' => \App\Models\Genre::all()]);
|
||||
}
|
||||
}
|
35
app/Http/Controllers/Main/MovieController.php
Normal file
35
app/Http/Controllers/Main/MovieController.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Main;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class MovieController extends Controller
|
||||
{
|
||||
public function showAllMovies()
|
||||
{
|
||||
return view('main.movies.index', ['title' => "Movies", 'movies' => \App\Models\Movie::all(), 'genres' => \App\Models\Genre::all(), 'showings' => \App\Models\Showing::all()]);
|
||||
}
|
||||
|
||||
public function moviesNowShowing()
|
||||
{
|
||||
// map showings that are in the future to movies
|
||||
$showings = \App\Models\Showing::all()->filter(function ($showing) {
|
||||
return $showing->showing_start > now();
|
||||
});
|
||||
// $movies must be a collection of unique movies
|
||||
$movies = collect();
|
||||
foreach ($showings as $showing) {
|
||||
if (!$movies->contains($showing->movie)) {
|
||||
$movies->push($showing->movie);
|
||||
}
|
||||
}
|
||||
return view('main.movies.index', ['title' => "Movies Now Showing", 'movies' => $movies, 'genres' => \App\Models\Genre::all(), 'showings' => \App\Models\Showing::all()]);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
return view('main.movies.movie', ['title' => "Movie", 'movie' => \App\Models\Movie::findOrfail($id)]);
|
||||
}
|
||||
}
|
24
app/Http/Controllers/Main/ShowingController.php
Normal file
24
app/Http/Controllers/Main/ShowingController.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Main;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ShowingController extends Controller
|
||||
{
|
||||
public function show($id)
|
||||
{
|
||||
return view('main.showings.showing', ['title' => "Showing", 'showing' => \App\Models\Showing::findOrfail($id)]);
|
||||
}
|
||||
|
||||
public function showAllShowings()
|
||||
{
|
||||
return view('main.showings.index', ['title' => "Showings", 'showings' => \App\Models\Showing::all()]);
|
||||
}
|
||||
|
||||
public function order($id)
|
||||
{
|
||||
return view('main.order', ['title' => "Order Tickets", 'showing' => \App\Models\Showing::findOrfail($id)]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue