$model->podcast->language_code

This commit is contained in:
Benjamin Takats
2023-01-27 14:35:54 +01:00
parent 2b46013f20
commit 5ecaf43d6b
6 changed files with 92 additions and 51 deletions

View File

@@ -6,7 +6,6 @@ use App\Models\Country;
use App\Models\Library;
use App\Models\LibraryItem;
use App\Models\Tag;
use Illuminate\Pagination\LengthAwarePaginator;
use Livewire\Component;
use RalphJSmit\Laravel\SEO\Support\SEOData;
@@ -103,8 +102,10 @@ class LibraryTable extends Component
->where('libraries.name', $this->currentTab)
)
)
->when(count($this->filters) > 0, fn($query) => $query->whereHas('tags',
fn($query) => $query->whereIn('tags.id', $this->filters)))
->when(isset($this->filters['tag']), fn($query) => $query->whereHas('tags',
fn($query) => $query->whereIn('tags.id', $this->filters['tag'])))
->when(isset($this->filters['language']),
fn($query) => $query->whereIn('language_code', $this->filters['language']))
->whereHas('libraries',
fn($query) => $query->where('libraries.is_public', $shouldBePublic))
->orderByDesc('library_items.created_at')

View File

@@ -2,6 +2,7 @@
namespace App\Http\Livewire\Library;
use App\Models\LibraryItem;
use App\Models\Tag;
use Livewire\Component;
@@ -21,6 +22,15 @@ class SearchByTagComponent extends Component
->getName() !== 'library.table.lecturer';
return view('livewire.library.search-by-tag-component', [
'languages' => LibraryItem::query()
->pluck('language_code')
->unique()
->sort()
->map(fn($item) => str($item)
->before('_')
->toString())
->values()
->toArray(),
'tags' => Tag::query()
->with([
'libraryItems.libraries',
@@ -30,7 +40,8 @@ class SearchByTagComponent extends Component
'libraryItems',
])
->where('type', 'library_item')
->whereHas('libraryItems.libraries', fn($query) => $query->where('is_public', $shouldBePublic))
->whereHas('libraryItems.libraries',
fn($query) => $query->where('is_public', $shouldBePublic))
->orderByDesc('library_items_count')
->orderBy('tags.id')
->get(),

View File

@@ -53,7 +53,9 @@ class Episode extends Resource
'episode_id' => $model->id,
'name' => $model->data['title'],
'type' => 'podcast_episode',
'language_code' => $model->podcast->language_code,
'language_code' => str($model->podcast->language_code)
->before('-')
->toString(),
'value' => null,
'excerpt' => $model->data['description'],
'subtitle' => $model->data['description'],

View File

@@ -110,6 +110,7 @@
option-value="language"
/>
</div>
@auth
<div></div>
@else
@@ -128,16 +129,16 @@
</div>
</section>
<section class="h-auto">
<div class="px-10 py-2 sm:py-6 mx-auto max-w-7xl">
<div class="px-10 py-2 mx-auto max-w-7xl">
<div class="w-full mx-auto text-left md:text-center">
@if(str(request()->route()->getName())->contains('school.'))
<div>
<h1 class="mb-6 text-5xl font-extrabold leading-none max-w-5xl mx-auto tracking-normal text-gray-200 sm:text-6xl md:text-6xl lg:text-7xl md:tracking-tight">
<h1 class="mb-2 text-5xl font-extrabold leading-none max-w-5xl mx-auto tracking-normal text-gray-200 sm:text-6xl md:text-6xl lg:text-7xl md:tracking-tight">
Bitcoin <span
class="w-full text-transparent bg-clip-text bg-gradient-to-r from-amber-400 via-amber-500 to-amber-200 lg:inline">{{ __('Courses') }}</span>
</h1>
<p class="px-0 mb-6 text-lg text-gray-600 md:text-xl lg:px-24">
<p class="px-0 mb-2 text-lg text-gray-600 md:text-xl lg:px-24">
{{ __('Choose your city, search for courses in the surrounding area and select a topic that suits you.') }}
</p>
</div>
@@ -145,11 +146,11 @@
@if(str(request()->route()->getName())->contains('library.'))
<div>
<h1 class="mb-6 text-5xl font-extrabold leading-none max-w-5xl mx-auto tracking-normal text-gray-200 sm:text-6xl md:text-6xl lg:text-7xl md:tracking-tight">
<h1 class="mb-2 text-5xl font-extrabold leading-none max-w-5xl mx-auto tracking-normal text-gray-200 sm:text-6xl md:text-6xl lg:text-7xl md:tracking-tight">
Bitcoin <span
class="w-full text-transparent bg-clip-text bg-gradient-to-r from-amber-400 via-amber-500 to-amber-200 lg:inline">{{ __('Content') }}</span>
</h1>
<p class="px-0 mb-6 text-lg text-gray-600 md:text-xl lg:px-24">
<p class="px-0 mb-2 text-lg text-gray-600 md:text-xl lg:px-24">
{{ __('Choose a topic that is right for you.') }}
</p>
</div>

View File

@@ -1,3 +1,28 @@
<div>
<div
class="flex overflow-auto relative flex-wrap gap-x-1 gap-y-1 justify-left p-0 mx-auto mt-2 mb-2 w-full font-normal text-white align-baseline border-0 border-solid md:mx-auto md:mb-0 md:max-w-screen-2xl"
>
@foreach($languages as $language)
<div
class="flex flex-wrap justify-left p-0 m-0 text-center align-baseline border-0 border-solid"
style="font-size: 128%; background-position: 0px center; list-style: outside;"
>
<a
href="{{ route(request()->route()->getName(), ['country' => $country, 'filters' => ['language' => [$language]]]) }}"
>
@if(in_array($language, $filters['language'] ?? [], false))
<x-badge squared amber>
{{ $language }}
</x-badge>
@else
<x-badge squared gray>
{{ $language }}
</x-badge>
@endif
</a>
</div>
@endforeach
</div>
<div
class="flex overflow-auto relative flex-wrap gap-x-1 gap-y-1 justify-left p-0 mx-auto mt-2 mb-2 w-full font-normal text-white align-baseline border-0 border-solid md:mx-auto md:mb-0 md:max-w-screen-2xl"
>
@@ -24,3 +49,4 @@
</div>
@endforeach
</div>
</div>

View File

@@ -292,9 +292,9 @@ camelcase-css@^2.0.1:
integrity sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==
caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001426:
version "1.0.30001446"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001446.tgz#6d4ba828ab19f49f9bcd14a8430d30feebf1e0c5"
integrity sha512-fEoga4PrImGcwUUGEol/PoFCSBnSkA9drgdkxXkJLsUBOnJ8rs3zDv6ApqYXGQFOyMPsjh79naWhF4DAxbF8rw==
version "1.0.30001449"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001449.tgz#a8d11f6a814c75c9ce9d851dc53eb1d1dfbcd657"
integrity sha512-CPB+UL9XMT/Av+pJxCKGhdx+yg1hzplvFJQlJ2n68PyQGMz9L/E2zCyLdOL8uasbouTUgnPl+y0tccI/se+BEw==
chokidar@^3.5.3:
version "3.5.3"