Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Fix) Mediahub: genres, companies, networks, persons, tv/movies #1787

Merged
merged 1 commit into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/Http/Controllers/MediaHub/CompanyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,14 @@ public function index(): \Illuminate\Contracts\View\Factory | \Illuminate\View\V
*/
public function show($id): \Illuminate\Contracts\View\Factory | \Illuminate\View\View
{
$company = Company::with('tv', 'movie')->findOrFail($id);
$company = Company::withCount('tv', 'movie')->findOrFail($id);
$shows = $company->tv()->orderBy('name', 'asc')->paginate(25);
$movies = $company->movie()->orderBy('title', 'asc')->paginate(25);

return \view('mediahub.company.show', [
'company' => $company,
'shows' => $shows,
'movies' => $movies,
]);
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/MediaHub/GenreController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function index(): \Illuminate\Contracts\View\Factory | \Illuminate\View\V
*/
public function show($id): \Illuminate\Contracts\View\Factory | \Illuminate\View\View
{
$genre = Genre::with(['tv', 'movie'])->findOrFail($id);
$genre = Genre::withCount(['tv', 'movie'])->findOrFail($id);
$shows = $genre->tv()->orderBy('name', 'asc')->paginate(25);
$movies = $genre->movie()->orderBy('title', 'asc')->paginate(25);

Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/MediaHub/NetworkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ public function index(): \Illuminate\Contracts\View\Factory | \Illuminate\View\V
*/
public function show($id): \Illuminate\Contracts\View\Factory | \Illuminate\View\View
{
$network = Network::with('tv')->findOrFail($id);
$network = Network::withCount('tv')->findOrFail($id);
$shows = $network->tv()->orderBy('name', 'asc')->paginate(25);

return \view('mediahub.network.show', [
'network' => $network,
'shows' => $shows,
]);
}
}
1 change: 1 addition & 0 deletions resources/lang/en/mediahub.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
'latest-project' => 'Latest Project:',
'networks' => 'Networks',
'no-data' => 'No Data Found!',
'movie' => 'Movie',
'movies' => 'Movies',
'movie-credits' => 'Movie Credits:',
'persons' => 'Persons',
Expand Down
59 changes: 52 additions & 7 deletions resources/views/mediahub/company/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,20 @@
<div class="block">
<div style="width: 100% !important; display: table !important;">
<div class="header mediahub" style="width: 100% !important; display: table-cell !important;">
<h1 class="text-center" style=" height: 100px; font-family: Shrikhand, cursive; font-size: 4em; font-weight: 400; margin: 0;">
<h1 class="text-center" style="font-family: Shrikhand, cursive; font-size: 4em; font-weight: 400; margin: 10px 0 20px;">
{{ $company->name }}
</h1>
<h2 class="text-center" style="margin: 0;">{{ $company->tv->count() }} @lang('mediahub.shows')</h2>
@foreach($company->tv as $show)
<h2 class="text-center" style="margin: 0;">{{ $company->tv_count }} @lang('mediahub.shows') | {{ $company->movie_count }} @lang('mediahub.movies')</h2>
@foreach($shows as $show)
<div class="col-md-12">
<div class="card is-torrent">
<div class="card_head">
<span class="badge-user text-bold" style="float:right;">
<i class="{{ config('other.font-awesome') }} fa-fw fa-arrow-up text-green"></i> {{ $show->episode_run_time }}
</span>
<span class="badge-user text-bold" style="float:right;">
{{ $show->number_of_seasons }} @lang('mediahub.seasons')
</span>
<span class="badge-user text-bold" style="float:right;">
{{ $show->number_of_episodes }} @lang('mediahub.episodes')
</span>
</div>
<div class="card_body">
<div class="body_poster">
Expand All @@ -50,7 +53,7 @@
<div class="body_description">
<h3 class="description_title">
<a href="{{ route('mediahub.shows.show', ['id' => $show->id]) }}">{{ $show->name }}
<span class="text-bold text-pink"> ({{ $show->first_air_date }})</span>
<span class="text-bold text-pink"> {{ substr($show->first_air_date, 0, 4) }}</span>
</a>
</h3>
@if ($show->genres)
Expand All @@ -67,10 +70,52 @@
<div style="float: left;">

</div>
</div>
</div>
</div>
@endforeach
@if ($movies->isNotEmpty())
<div class="col-md-12">
<h2 class="text-center">Movies</h2>
</div>
@endif
@foreach($movies as $movie)
<div class="col-md-12">
<div class="card is-torrent">
<div class="card_head">
<span class="badge-user text-bold" style="float:right;">
<i class="far fa-fw fa-clock text-green"></i> {{ $movie->runtime }} mins
</span>
</div>
<div class="card_body">
<div class="body_poster">
<img src="{{ isset($movie->poster) ? \tmdb_image('poster_mid', $movie->poster) : 'https://via.placeholder.com/200x300' }}" class="show-poster">
</div>
<div class="body_description">
<h3 class="description_title">
<a href="{{ route('mediahub.movies.show', ['id' => $movie->id]) }}">{{ $movie->title }}
<span class="text-bold text-pink"> {{ substr($movie->release_date, 0, 4) }}</span>
</a>
</h3>
@foreach ($movie->genres as $genre)
<span class="genre-label">{{ $genre->name }}</span>
@endforeach
<p class="description_plot">
{{ $movie->overview }}
</p>
</div>
</div>
<div class="card_footer">
<div style="float: left;">

</div>
</div>
</div>
</div>
@endforeach
<div class="text-center">
{{ ($company->tv_count > 25 && $company->tv_count > $company->movie_count) ? $shows->links() : $movies->links() }}
</div>
</div>
</div>
</div>
Expand Down
60 changes: 34 additions & 26 deletions resources/views/mediahub/genre/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,38 @@
<div class="block">
<div style="width: 100% !important; display: table !important;">
<div class="header mediahub" style="width: 100% !important; display: table-cell !important;">
<h1 class="text-center" style=" height: 100px; font-family: Shrikhand, cursive; font-size: 7em; font-weight: 400; margin: 0;">
<h1 class="text-center" style="font-family: Shrikhand, cursive; font-size: 7em; font-weight: 400; margin: 10px 0">
{{ $genre->name }}
</h1>
<hr>
<h2 class="text-center">{{ $genre->tv->count() }} TV Shows | {{ $genre->movie->count() }} @lang('mediahub.movies')</h2>
@foreach($movies as $movie)
<h2 class="text-center">{{ $genre->tv_count }} @lang('mediahub.shows') | {{ $genre->movie_count }} @lang('mediahub.movies')</h2>
@foreach($shows as $show)
<div class="col-md-12">
<div class="card is-torrent">
<div class="card_head">
<span class="badge-user text-bold" style="float:right;">
<i class="{{ config('other.font-awesome') }} fa-fw fa-arrow-up text-green"></i> {{ $movie->runtime }}
</span>
<span class="badge-user text-bold" style="float:right;">
{{ $show->number_of_seasons }} @lang('mediahub.seasons')
</span>
<span class="badge-user text-bold" style="float:right;">
{{ $show->number_of_episodes }} @lang('mediahub.episodes')
</span>
</div>
<div class="card_body">
<div class="body_poster">
<img src="{{ isset($movie->poster) ? \tmdb_image('poster_mid', $movie->poster) : 'https://via.placeholder.com/200x300' }}" class="show-poster">
<img src="{{ isset($show->poster) ? \tmdb_image('poster_mid', $show->poster) : 'https://via.placeholder.com/200x300' }}" class="show-poster">
</div>
<div class="body_description">
<h3 class="description_title">
<a href="#">{{ $movie->title }}
<span class="text-bold text-pink"> {{ substr($movie->release_date, 0, 4) }}</span>
<a href="{{ route('mediahub.shows.show', ['id' => $show->id]) }}">{{ $show->name }}
<span class="text-bold text-pink"> {{ substr($show->first_air_date, 0, 4) }}</span>
</a>
</h3>
@foreach ($movie->genres as $genre)
<span class="genre-label">{{ $genre->name }}</span>
@endforeach
@if ($show->genres)
@foreach ($show->genres as $genre)
<span class="genre-label">{{ $genre->name }}</span>
@endforeach
@endif
<p class="description_plot">
{{ $movie->overview }}
{{ $show->overview }}
</p>
</div>
</div>
Expand All @@ -70,43 +74,47 @@
</div>
</div>
@endforeach

@foreach($shows as $show)
@if ($movies->isNotEmpty())
<div class="col-md-12">
<h2 class="text-center">Movies</h2>
</div>
@endif
@foreach($movies as $movie)
<div class="col-md-12">
<div class="card is-torrent">
<div class="card_head">
<span class="badge-user text-bold" style="float:right;">
<i class="{{ config('other.font-awesome') }} fa-fw fa-arrow-up text-green"></i> {{ $show->episode_run_time }}
</span>
<span class="badge-user text-bold" style="float:right;">
<i class="far fa-fw fa-clock text-green"></i> {{ $movie->runtime }} mins
</span>
</div>
<div class="card_body">
<div class="body_poster">
<img src="{{ isset($show->poster) ? \tmdb_image('poster_mid', $show->poster) : 'https://via.placeholder.com/200x300' }}" class="show-poster">
<img src="{{ isset($movie->poster) ? \tmdb_image('poster_mid', $movie->poster) : 'https://via.placeholder.com/200x300' }}" class="show-poster">
</div>
<div class="body_description">
<h3 class="description_title">
<a href="{{ route('mediahub.shows.show', ['id' => $show->id]) }}">{{ $show->name }}
<span class="text-bold text-pink"> {{ substr($show->first_air_date, 0, 4) }}</span>
<a href="{{ route('mediahub.movies.show', ['id' => $movie->id]) }}">{{ $movie->title }}
<span class="text-bold text-pink"> {{ substr($movie->release_date, 0, 4) }}</span>
</a>
</h3>
@foreach ($show->genres as $genre)
@foreach ($movie->genres as $genre)
<span class="genre-label">{{ $genre->name }}</span>
@endforeach
<p class="description_plot">
{{ $show->overview }}
{{ $movie->overview }}
</p>
</div>
</div>
<div class="card_footer">
<div style="float: left;">

</div>
</div>
</div>
</div>
</div>
@endforeach
<div class="text-center">
{{ $shows->links() }}
{{ ($genre->tv_count > 25 && $genre->tv_count > $genre->movie_count) ? $shows->links() : $movies->links() }}
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/mediahub/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<h6 style="font-size: 10px;">
<i>@lang('mediahub.disclaimer')</i>
</h6>
<img src="/img/tmdb_long.svg" style="width: 200px;">
<img class="mb-20" src="/img/tmdb_long.svg" style="width: 200px;">
</div>
</div>
</div>
Expand Down
19 changes: 17 additions & 2 deletions resources/views/mediahub/movie/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@
@lang('mediahub.movies')
</div>

<div class="movie-right">
@if(isset($movie->companies) && $movie->companies->isNotEmpty())
@php $company = $movie->companies->first(); @endphp
<div class="badge-user">
<a href="{{ route('mediahub.companies.show', ['id' => $company->id]) }}">
@if(isset($company->logo))
<img class="img-responsive" src="{{ \tmdb_image('logo_small', $company->logo) }}" title="{{ $company->name }}">
@else
{{ $company->name }}
@endif
</a>
</div>
@endif
</div>

@php $tmdb_backdrop = $movie->backdrop ? \tmdb_image('back_big', $movie->backdrop) : 'https://via.placeholder.com/960x540'; @endphp
<div class="movie-backdrop" style="background-image: url('{{ $tmdb_backdrop }}');"></div>

Expand All @@ -54,7 +69,7 @@
</h1>

<div class="movie-overview">
{{ isset($meta->overview) ? Str::limit($movie->overview, $limit = 350, $end = '...') : '' }}
{{ isset($movie->overview) ? Str::limit($movie->overview, $limit = 350, $end = '...') : '' }}
</div>
</div>

Expand Down Expand Up @@ -98,7 +113,7 @@
</div>

<div class="movie-details">
@if(isset($meta) && !empty(trim($movie->homepage)))
@if(isset($movie) && !empty(trim($movie->homepage)))
<span class="badge-user text-bold">
<a href="{{ $movie->homepage }}" title="Homepage" rel="noopener noreferrer" target="_blank">
<i class="{{ config('other.font-awesome') }} fa-external-link-alt"></i> Homepage
Expand Down
Loading