Apply Laravel coding style

Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions.

You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root.

For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
This commit is contained in:
Shift
2023-02-19 16:18:46 +00:00
committed by HolgerHatGarKeineNode
parent a15ca4a2bc
commit 5776b01d15
333 changed files with 4915 additions and 4967 deletions

View File

@@ -12,7 +12,9 @@ use RalphJSmit\Laravel\SEO\Support\SEOData;
class LibraryTable extends Component
{
public Country $country;
public array $filters = [];
public bool $isLecturerPage = false;
public string $search = '';
@@ -23,8 +25,8 @@ class LibraryTable extends Component
protected $queryString = [
'currentTab' => ['except' => '*'],
'filters' => ['except' => ''],
'search' => ['except' => ''],
'filters' => ['except' => ''],
'search' => ['except' => ''],
];
public function loadMore()
@@ -52,7 +54,7 @@ class LibraryTable extends Component
public function render()
{
$shouldBePublic = !$this->isLecturerPage;
$shouldBePublic = ! $this->isLecturerPage;
$libraries = \App\Models\Library::query()
->whereNull('parent_id')
->where('is_public', $shouldBePublic)
@@ -61,7 +63,7 @@ class LibraryTable extends Component
$tabs = collect([
[
'name' => '*',
]
],
]);
foreach ($libraries as $library) {
$tabs->push([
@@ -82,32 +84,32 @@ class LibraryTable extends Component
}
return view('livewire.library.library-table', [
'libraries' => $tabs,
'libraries' => $tabs,
'libraryItems' => LibraryItem::query()
->with([
'lecturer',
'tags',
])
->when($this->search, fn($query) => $query
->when($this->search, fn ($query) => $query
->where('name', 'ilike', '%'.$this->search.'%')
->orWhere(fn($query) => $query
->orWhere(fn ($query) => $query
->when(count($searchTags) > 0 && count($this->filters) < 1,
fn($query) => $query->whereHas('tags',
fn($query) => $query->whereIn('tags.id', $searchTags)))
fn ($query) => $query->whereHas('tags',
fn ($query) => $query->whereIn('tags.id', $searchTags)))
)
)
->when($this->currentTab !== '*', fn($query) => $query
->when($this->currentTab !== '*', fn ($query) => $query
->whereHas('libraries',
fn($query) => $query
fn ($query) => $query
->where('libraries.name', $this->currentTab)
)
)
->when(isset($this->filters['tag']), fn($query) => $query->whereHas('tags',
fn($query) => $query->whereIn('tags.id', $this->filters['tag'])))
->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']))
fn ($query) => $query->whereIn('language_code', $this->filters['language']))
->whereHas('libraries',
fn($query) => $query->where('libraries.is_public', $shouldBePublic))
fn ($query) => $query->where('libraries.is_public', $shouldBePublic))
->orderByDesc('library_items.created_at')
->paginate($this->perPage),
])->layout('layouts.app', [
@@ -115,7 +117,7 @@ class LibraryTable extends Component
title: __('Library'),
description: __('Here you can find all content that are available in the library.'),
image: asset('img/screenshot.png')
)
),
]);
}
}