mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
split into modules
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Frontend;
|
||||
|
||||
use App\Models\BookCase;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithFileUploads;
|
||||
|
||||
class CommentBookCase extends Component
|
||||
{
|
||||
use WithFileUploads;
|
||||
|
||||
public $photo;
|
||||
|
||||
public string $c = 'de';
|
||||
|
||||
public BookCase $bookCase;
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.frontend.comment-book-case');
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$this->validate([
|
||||
'photo' => 'image|max:4096', // 4MB Max
|
||||
]);
|
||||
|
||||
$this->bookCase
|
||||
->addMedia($this->photo)
|
||||
->toMediaCollection('images');
|
||||
|
||||
return to_route('comment.bookcase', ['bookCase' => $this->bookCase->id]);
|
||||
}
|
||||
|
||||
protected function url_to_absolute($url)
|
||||
{
|
||||
if (str($url)->contains('http')) {
|
||||
return $url;
|
||||
}
|
||||
if (!str($url)->contains('http')) {
|
||||
return str($url)->prepend('https://');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ use Livewire\Component;
|
||||
|
||||
class Header extends Component
|
||||
{
|
||||
public Country $country;
|
||||
public ?Country $country = null;
|
||||
public $currentRouteName;
|
||||
public string $c = 'de';
|
||||
public bool $withGlobe = true;
|
||||
@@ -23,6 +23,11 @@ class Header extends Component
|
||||
|
||||
public function mount()
|
||||
{
|
||||
if (!$this->country) {
|
||||
$this->country = Country::query()
|
||||
->where('code', $this->c)
|
||||
->first();
|
||||
}
|
||||
$this->currentRouteName = Route::currentRouteName();
|
||||
$this->c = $this->country->code;
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Frontend;
|
||||
|
||||
use App\Models\Country;
|
||||
use App\Models\Podcast;
|
||||
use Livewire\Component;
|
||||
|
||||
class Library extends Component
|
||||
{
|
||||
public Country $country;
|
||||
|
||||
public $currentTab = 'Alle';
|
||||
|
||||
protected $queryString = [
|
||||
'currentTab' => ['except' => 'alle'],
|
||||
];
|
||||
|
||||
public function render()
|
||||
{
|
||||
$shouldBePublic = request()
|
||||
->route()
|
||||
->getName() !== 'library.lecturer';
|
||||
if (!$shouldBePublic && !auth()->user()->is_lecturer) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
$libraries = \App\Models\Library::query()
|
||||
->where('is_public', $shouldBePublic)
|
||||
->get();
|
||||
$tabs = collect([
|
||||
[
|
||||
'name' => 'Alle',
|
||||
]
|
||||
]);
|
||||
foreach ($libraries as $library) {
|
||||
$tabs->push([
|
||||
'name' => $library->name,
|
||||
]);
|
||||
}
|
||||
|
||||
return view('livewire.frontend.library', [
|
||||
'libraries' => $tabs,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Frontend;
|
||||
|
||||
use App\Models\BookCase;
|
||||
use App\Models\Country;
|
||||
use Livewire\Component;
|
||||
|
||||
class SearchBookCase extends Component
|
||||
{
|
||||
public string $c = 'de';
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.frontend.search-book-case', [
|
||||
'bookCases' => BookCase::get(),
|
||||
'countries' => Country::query()
|
||||
->select(['code', 'name'])
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Frontend;
|
||||
|
||||
use App\Models\Tag;
|
||||
use Livewire\Component;
|
||||
|
||||
class SearchByTag extends Component
|
||||
{
|
||||
public string $country = 'de';
|
||||
public ?array $table = [];
|
||||
|
||||
protected $queryString = [
|
||||
'table',
|
||||
];
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.frontend.search-by-tag', [
|
||||
'tags' => Tag::query()
|
||||
->where('type', 'course')
|
||||
->with([
|
||||
'courses.lecturer',
|
||||
])
|
||||
->withCount([
|
||||
'courses',
|
||||
])
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Frontend;
|
||||
|
||||
use App\Models\Tag;
|
||||
use Livewire\Component;
|
||||
|
||||
class SearchByTagInLibrary extends Component
|
||||
{
|
||||
public string $country = 'de';
|
||||
public ?array $table = [];
|
||||
|
||||
protected $queryString = [
|
||||
'table',
|
||||
];
|
||||
|
||||
public function render()
|
||||
{
|
||||
$shouldBePublic = request()
|
||||
->route()
|
||||
->getName() !== 'library.lecturer';
|
||||
|
||||
return view('livewire.frontend.search-by-tag-in-library', [
|
||||
'tags' => Tag::query()
|
||||
->with([
|
||||
'libraryItems.libraries',
|
||||
'libraryItems.lecturer',
|
||||
])
|
||||
->withCount([
|
||||
'libraryItems',
|
||||
])
|
||||
->where('type', 'library_item')
|
||||
->whereHas('libraryItems.libraries', fn($query) => $query->where('is_public', $shouldBePublic))
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Frontend;
|
||||
|
||||
use App\Models\Country;
|
||||
use Livewire\Component;
|
||||
|
||||
class SearchCity extends Component
|
||||
{
|
||||
public Country $country;
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.frontend.search-city');
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Frontend;
|
||||
|
||||
use App\Models\Country;
|
||||
use Livewire\Component;
|
||||
|
||||
class SearchCourse extends Component
|
||||
{
|
||||
public Country $country;
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.frontend.search-course');
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Frontend;
|
||||
|
||||
use App\Models\Country;
|
||||
use Livewire\Component;
|
||||
|
||||
class SearchEvent extends Component
|
||||
{
|
||||
public Country $country;
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.frontend.search-event');
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Frontend;
|
||||
|
||||
use App\Models\Country;
|
||||
use Livewire\Component;
|
||||
|
||||
class SearchLecturer extends Component
|
||||
{
|
||||
public Country $country;
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.frontend.search-lecturer');
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Frontend;
|
||||
|
||||
use App\Models\Country;
|
||||
use Livewire\Component;
|
||||
|
||||
class SearchVenue extends Component
|
||||
{
|
||||
public Country $country;
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.frontend.search-venue');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user