mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
new library added
This commit is contained in:
@@ -12,6 +12,7 @@ class Header extends Component
|
||||
public Country $country;
|
||||
public $currentRouteName;
|
||||
public string $c = 'de';
|
||||
public bool $withGlobe = true;
|
||||
|
||||
public function rules()
|
||||
{
|
||||
|
||||
27
app/Http/Livewire/Frontend/Library.php
Normal file
27
app/Http/Livewire/Frontend/Library.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Frontend;
|
||||
|
||||
use App\Models\Country;
|
||||
use Livewire\Component;
|
||||
|
||||
class Library extends Component
|
||||
{
|
||||
public Country $country;
|
||||
|
||||
public $currentTab = 'Alle';
|
||||
|
||||
protected $queryString = [
|
||||
'currentTab' => ['except' => 'alle'],
|
||||
];
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.frontend.library', [
|
||||
'libraries' => \App\Models\Library::get()
|
||||
->prepend(\App\Models\Library::make([
|
||||
'name' => 'Alle',
|
||||
])),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ class SearchByTag extends Component
|
||||
{
|
||||
return view('livewire.frontend.search-by-tag', [
|
||||
'tags' => Tag::query()
|
||||
->where('type', 'course')
|
||||
->with([
|
||||
'courses.lecturer',
|
||||
])
|
||||
|
||||
25
app/Http/Livewire/Frontend/SearchByTagInLibrary.php
Normal file
25
app/Http/Livewire/Frontend/SearchByTagInLibrary.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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()
|
||||
{
|
||||
return view('livewire.frontend.search-by-tag-in-library', [
|
||||
'tags' => Tag::query()
|
||||
->where('type', 'library_item')
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class CourseTable extends DataTableComponent
|
||||
->toArray()
|
||||
)
|
||||
->filter(function (Builder $builder, array $values) {
|
||||
$builder->withAnyTags($values, 'search');
|
||||
$builder->withAnyTags($values, 'course');
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -55,6 +55,11 @@ class LecturerTable extends DataTableComponent
|
||||
fn($row, Column $column) => $row->courses_count
|
||||
)
|
||||
->collapseOnMobile(),
|
||||
Column::make('Inhalte')
|
||||
->label(
|
||||
fn($row, Column $column) => $row->library_items_count
|
||||
)
|
||||
->collapseOnMobile(),
|
||||
Column::make('')
|
||||
->label(
|
||||
fn($row, Column $column) => view('columns.lectures.action')->withRow($row)
|
||||
@@ -68,6 +73,7 @@ class LecturerTable extends DataTableComponent
|
||||
return Lecturer::query()
|
||||
->withCount([
|
||||
'courses',
|
||||
'libraryItems',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
61
app/Http/Livewire/Tables/LibraryItemTable.php
Normal file
61
app/Http/Livewire/Tables/LibraryItemTable.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Tables;
|
||||
|
||||
use App\Models\LibraryItem;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
||||
use Rappasoft\LaravelLivewireTables\Views\Column;
|
||||
use Rappasoft\LaravelLivewireTables\Views\Columns\ImageColumn;
|
||||
|
||||
class LibraryItemTable extends DataTableComponent
|
||||
{
|
||||
protected $model = LibraryItem::class;
|
||||
|
||||
public function configure(): void
|
||||
{
|
||||
$this
|
||||
->setPrimaryKey('id')
|
||||
->setDefaultSort('order_column', 'asc');
|
||||
}
|
||||
|
||||
public function columns(): array
|
||||
{
|
||||
return [
|
||||
ImageColumn::make('Bild')
|
||||
->location(
|
||||
fn($row) => $row->getFirstMediaUrl('main', 'thumb')
|
||||
)
|
||||
->attributes(fn($row) => [
|
||||
'class' => 'rounded h-16',
|
||||
'alt' => $row->name.' Avatar',
|
||||
])
|
||||
->collapseOnMobile(),
|
||||
Column::make('Dozent', "lecturer.name")
|
||||
->label(
|
||||
fn($row, Column $column) => view('columns.courses.lecturer')->withRow($row)
|
||||
)
|
||||
->sortable()
|
||||
->collapseOnMobile(),
|
||||
Column::make("Name", "name")
|
||||
->sortable(),
|
||||
Column::make("Art", "type")
|
||||
->sortable(),
|
||||
Column::make("Sprache", "language_code")
|
||||
->sortable(),
|
||||
|
||||
Column::make('')
|
||||
->label(
|
||||
fn($row, Column $column) => view('columns.library_items.action')->withRow($row)
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
public function builder(): Builder
|
||||
{
|
||||
return LibraryItem::query()
|
||||
->withCount([
|
||||
'lecturer',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user