AttachLibraryItemToLibrary

This commit is contained in:
Benjamin Takats
2023-01-22 13:00:20 +01:00
parent 81f85b0d10
commit 72df62a765
12 changed files with 38 additions and 15 deletions

View File

@@ -5,7 +5,7 @@ namespace App\Nova\Filters;
use Laravel\Nova\Filters\BooleanFilter; use Laravel\Nova\Filters\BooleanFilter;
use Laravel\Nova\Http\Requests\NovaRequest; use Laravel\Nova\Http\Requests\NovaRequest;
class LibraryItemWithoutLibrary extends BooleanFilter class LibraryItemWithout extends BooleanFilter
{ {
/** /**
* Apply the filter to the given query. * Apply the filter to the given query.
@@ -18,7 +18,9 @@ class LibraryItemWithoutLibrary extends BooleanFilter
*/ */
public function apply(NovaRequest $request, $query, $value) public function apply(NovaRequest $request, $query, $value)
{ {
return $query->when($value['without'], fn($query) => $query->whereDoesntHave('libraries')); return $query
->when($value['libraries'], fn($query) => $query->whereDoesntHave('libraries'))
->when($value['tags'], fn($query) => $query->whereDoesntHave('tags'));
} }
/** /**
@@ -31,7 +33,8 @@ class LibraryItemWithoutLibrary extends BooleanFilter
public function options(NovaRequest $request) public function options(NovaRequest $request)
{ {
return [ return [
'Library-Item without Library' => 'without', __('Library items without libraries') => 'libraries',
__('Library items without tags') => 'tags',
]; ];
} }
} }

View File

@@ -6,7 +6,7 @@ use App\Enums\LibraryItemType;
use App\Notifications\ModelCreatedNotification; use App\Notifications\ModelCreatedNotification;
use App\Nova\Actions\AttachLibraryItemToLibrary; use App\Nova\Actions\AttachLibraryItemToLibrary;
use App\Nova\Actions\SetStatusAction; use App\Nova\Actions\SetStatusAction;
use App\Nova\Filters\LibraryItemWithoutLibrary; use App\Nova\Filters\LibraryItemWithout;
use Ebess\AdvancedNovaMediaLibrary\Fields\Files; use Ebess\AdvancedNovaMediaLibrary\Fields\Files;
use Ebess\AdvancedNovaMediaLibrary\Fields\Images; use Ebess\AdvancedNovaMediaLibrary\Fields\Images;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
@@ -200,7 +200,7 @@ class LibraryItem extends Resource
public function filters(Request $request) public function filters(Request $request)
{ {
return [ return [
new LibraryItemWithoutLibrary() new LibraryItemWithout()
]; ];
} }

View File

@@ -690,5 +690,7 @@
"starts with: lnurl1dp68gurn8gh....": "startet mit: lnurl1dp68gurn8gh....", "starts with: lnurl1dp68gurn8gh....": "startet mit: lnurl1dp68gurn8gh....",
"for example xy@getalby.com": "zum Beispiel xy@getalby.com", "for example xy@getalby.com": "zum Beispiel xy@getalby.com",
"Only one working address is required. But you can also fill in all fields if you have suitable data.": "Nur eine funktionierende Adresse ist erforderlich. Aber du kannst auch alle Felder ausfüllen, wenn du passende Daten hast.", "Only one working address is required. But you can also fill in all fields if you have suitable data.": "Nur eine funktionierende Adresse ist erforderlich. Aber du kannst auch alle Felder ausfüllen, wenn du passende Daten hast.",
"Reset filtering and search": "Suche und Filter zurücksetzen" "Reset filtering and search": "Suche und Filter zurücksetzen",
"Library items without libraries": "Einträge ohne Bibliothek",
"Library items without tags": "Einträge ohne Tags"
} }

View File

@@ -684,5 +684,7 @@
"starts with: lnurl1dp68gurn8gh....": "", "starts with: lnurl1dp68gurn8gh....": "",
"for example xy@getalby.com": "", "for example xy@getalby.com": "",
"Only one working address is required. But you can also fill in all fields if you have suitable data.": "", "Only one working address is required. But you can also fill in all fields if you have suitable data.": "",
"Reset filtering and search": "" "Reset filtering and search": "",
"Library items without libraries": "",
"Library items without tags": ""
} }

View File

@@ -684,5 +684,7 @@
"starts with: lnurl1dp68gurn8gh....": "", "starts with: lnurl1dp68gurn8gh....": "",
"for example xy@getalby.com": "", "for example xy@getalby.com": "",
"Only one working address is required. But you can also fill in all fields if you have suitable data.": "", "Only one working address is required. But you can also fill in all fields if you have suitable data.": "",
"Reset filtering and search": "" "Reset filtering and search": "",
"Library items without libraries": "",
"Library items without tags": ""
} }

View File

@@ -685,5 +685,7 @@
"starts with: lnurl1dp68gurn8gh....": "", "starts with: lnurl1dp68gurn8gh....": "",
"for example xy@getalby.com": "", "for example xy@getalby.com": "",
"Only one working address is required. But you can also fill in all fields if you have suitable data.": "", "Only one working address is required. But you can also fill in all fields if you have suitable data.": "",
"Reset filtering and search": "" "Reset filtering and search": "",
"Library items without libraries": "",
"Library items without tags": ""
} }

View File

@@ -685,5 +685,7 @@
"starts with: lnurl1dp68gurn8gh....": "", "starts with: lnurl1dp68gurn8gh....": "",
"for example xy@getalby.com": "", "for example xy@getalby.com": "",
"Only one working address is required. But you can also fill in all fields if you have suitable data.": "", "Only one working address is required. But you can also fill in all fields if you have suitable data.": "",
"Reset filtering and search": "" "Reset filtering and search": "",
"Library items without libraries": "",
"Library items without tags": ""
} }

View File

@@ -685,5 +685,7 @@
"starts with: lnurl1dp68gurn8gh....": "", "starts with: lnurl1dp68gurn8gh....": "",
"for example xy@getalby.com": "", "for example xy@getalby.com": "",
"Only one working address is required. But you can also fill in all fields if you have suitable data.": "", "Only one working address is required. But you can also fill in all fields if you have suitable data.": "",
"Reset filtering and search": "" "Reset filtering and search": "",
"Library items without libraries": "",
"Library items without tags": ""
} }

View File

@@ -685,5 +685,7 @@
"starts with: lnurl1dp68gurn8gh....": "", "starts with: lnurl1dp68gurn8gh....": "",
"for example xy@getalby.com": "", "for example xy@getalby.com": "",
"Only one working address is required. But you can also fill in all fields if you have suitable data.": "", "Only one working address is required. But you can also fill in all fields if you have suitable data.": "",
"Reset filtering and search": "" "Reset filtering and search": "",
"Library items without libraries": "",
"Library items without tags": ""
} }

View File

@@ -685,5 +685,7 @@
"starts with: lnurl1dp68gurn8gh....": "", "starts with: lnurl1dp68gurn8gh....": "",
"for example xy@getalby.com": "", "for example xy@getalby.com": "",
"Only one working address is required. But you can also fill in all fields if you have suitable data.": "", "Only one working address is required. But you can also fill in all fields if you have suitable data.": "",
"Reset filtering and search": "" "Reset filtering and search": "",
"Library items without libraries": "",
"Library items without tags": ""
} }

View File

@@ -685,5 +685,7 @@
"starts with: lnurl1dp68gurn8gh....": "", "starts with: lnurl1dp68gurn8gh....": "",
"for example xy@getalby.com": "", "for example xy@getalby.com": "",
"Only one working address is required. But you can also fill in all fields if you have suitable data.": "", "Only one working address is required. But you can also fill in all fields if you have suitable data.": "",
"Reset filtering and search": "" "Reset filtering and search": "",
"Library items without libraries": "",
"Library items without tags": ""
} }

View File

@@ -659,5 +659,7 @@
"starts with: lnurl1dp68gurn8gh....": "", "starts with: lnurl1dp68gurn8gh....": "",
"for example xy@getalby.com": "", "for example xy@getalby.com": "",
"Only one working address is required. But you can also fill in all fields if you have suitable data.": "", "Only one working address is required. But you can also fill in all fields if you have suitable data.": "",
"Reset filtering and search": "" "Reset filtering and search": "",
"Library items without libraries": "",
"Library items without tags": ""
} }