From 7be1194e4356a367dd3b6cd376b18483aeb4884e Mon Sep 17 00:00:00 2001 From: Benjamin Takats Date: Thu, 15 Dec 2022 14:57:28 +0100 Subject: [PATCH] exceptOnForms for createdBy --- app/Nova/BitcoinEvent.php | 2 +- app/Nova/BookCase.php | 3 ++- app/Nova/City.php | 2 +- app/Nova/Course.php | 3 ++- app/Nova/CourseEvent.php | 3 ++- app/Nova/Episode.php | 3 ++- app/Nova/Lecturer.php | 3 ++- app/Nova/Library.php | 3 ++- app/Nova/LibraryItem.php | 21 ++++++++++++--------- app/Nova/Meetup.php | 3 ++- app/Nova/MeetupEvent.php | 3 ++- app/Nova/OrangePill.php | 1 + app/Nova/Podcast.php | 3 ++- app/Nova/Registration.php | 1 + app/Nova/Venue.php | 3 ++- 15 files changed, 36 insertions(+), 21 deletions(-) diff --git a/app/Nova/BitcoinEvent.php b/app/Nova/BitcoinEvent.php index d81b81b6..85e5edf5 100644 --- a/app/Nova/BitcoinEvent.php +++ b/app/Nova/BitcoinEvent.php @@ -80,7 +80,7 @@ class BitcoinEvent extends Resource ->searchable(), BelongsTo::make(__('Created By'), 'createdBy', User::class) - ->onlyOnIndex(), + ->exceptOnForms(), ]; } diff --git a/app/Nova/BookCase.php b/app/Nova/BookCase.php index fb582945..3a56186b 100644 --- a/app/Nova/BookCase.php +++ b/app/Nova/BookCase.php @@ -125,7 +125,8 @@ class BookCase extends Resource MorphMany::make(__('Comments'), 'comments', Comment::class), - BelongsTo::make(__('Created By'), 'createdBy', User::class)->onlyOnIndex(), + BelongsTo::make(__('Created By'), 'createdBy', User::class) + ->exceptOnForms(), ]; } diff --git a/app/Nova/City.php b/app/Nova/City.php index 8def874a..35e54bda 100644 --- a/app/Nova/City.php +++ b/app/Nova/City.php @@ -87,7 +87,7 @@ class City extends Resource HasMany::make(__('Meetups'), 'meetups', Meetup::class), BelongsTo::make(__('Created By'), 'createdBy', User::class) - ->onlyOnIndex(), + ->exceptOnForms(), ]; } diff --git a/app/Nova/Course.php b/app/Nova/Course.php index 7707015d..3d87eaa4 100644 --- a/app/Nova/Course.php +++ b/app/Nova/Course.php @@ -109,7 +109,8 @@ class Course extends Resource BelongsToMany::make(__('Categories'), 'categories', Category::class) ->onlyOnDetail(), - BelongsTo::make(__('Created By'), 'createdBy', User::class)->onlyOnIndex(), + BelongsTo::make(__('Created By'), 'createdBy', User::class) + ->exceptOnForms(), ]; } diff --git a/app/Nova/CourseEvent.php b/app/Nova/CourseEvent.php index db58ebd5..63793e67 100644 --- a/app/Nova/CourseEvent.php +++ b/app/Nova/CourseEvent.php @@ -90,7 +90,8 @@ class CourseEvent extends Resource BelongsTo::make(__('Venue'), 'venue', Venue::class) ->searchable(), - BelongsTo::make(__('Created By'), 'createdBy', User::class)->onlyOnIndex(), + BelongsTo::make(__('Created By'), 'createdBy', User::class) + ->exceptOnForms(), ]; } diff --git a/app/Nova/Episode.php b/app/Nova/Episode.php index 433576f0..2dfaca2c 100644 --- a/app/Nova/Episode.php +++ b/app/Nova/Episode.php @@ -112,7 +112,8 @@ class Episode extends Resource BelongsTo::make(__('Podcast'), 'podcast', Podcast::class) ->readonly(), - BelongsTo::make(__('Created By'), 'createdBy', User::class)->onlyOnIndex(), + BelongsTo::make(__('Created By'), 'createdBy', User::class) + ->exceptOnForms(), ]; } diff --git a/app/Nova/Lecturer.php b/app/Nova/Lecturer.php index a581d41f..5b12e583 100644 --- a/app/Nova/Lecturer.php +++ b/app/Nova/Lecturer.php @@ -97,7 +97,8 @@ class Lecturer extends Resource BelongsTo::make('Team'), - BelongsTo::make(__('Created By'), 'createdBy', User::class)->onlyOnIndex(), + BelongsTo::make(__('Created By'), 'createdBy', User::class) + ->exceptOnForms(), ]; } diff --git a/app/Nova/Library.php b/app/Nova/Library.php index 498ae467..63c63e86 100644 --- a/app/Nova/Library.php +++ b/app/Nova/Library.php @@ -76,7 +76,8 @@ class Library extends Resource BelongsToMany::make('Library Items'), - BelongsTo::make(__('Created By'), 'createdBy', User::class)->onlyOnIndex(), + BelongsTo::make(__('Created By'), 'createdBy', User::class) + ->exceptOnForms(), ]; } diff --git a/app/Nova/LibraryItem.php b/app/Nova/LibraryItem.php index e713aea0..f13eb795 100644 --- a/app/Nova/LibraryItem.php +++ b/app/Nova/LibraryItem.php @@ -31,12 +31,6 @@ class LibraryItem extends Resource * @var string */ public static $title = 'name'; - - public static function label() - { - return __('Library Item'); - } - /** * The columns that should be searched. * @var array @@ -46,6 +40,11 @@ class LibraryItem extends Resource 'name', ]; + public static function label() + { + return __('Library Item'); + } + public static function afterCreate(NovaRequest $request, Model $model) { \App\Models\User::find(1) @@ -93,7 +92,8 @@ class LibraryItem extends Resource Select::make(__('Type')) ->options( - Options::forEnum(LibraryItemType::class)->toArray() + Options::forEnum(LibraryItemType::class) + ->toArray() ) ->rules('required', 'string'), @@ -103,11 +103,14 @@ class LibraryItem extends Resource BelongsTo::make(__('Lecturer/Content Creator'), 'lecturer', Lecturer::class), - BelongsTo::make(__('Episode'), 'episode', Episode::class)->nullable(), + BelongsTo::make(__('Episode'), 'episode', Episode::class) + ->nullable() + ->exceptOnForms(), BelongsToMany::make(__('Library'), 'libraries', Library::class), - BelongsTo::make(__('Created By'), 'createdBy', User::class)->onlyOnIndex(), + BelongsTo::make(__('Created By'), 'createdBy', User::class) + ->exceptOnForms(), ]; } diff --git a/app/Nova/Meetup.php b/app/Nova/Meetup.php index 8b878cb3..80188b90 100644 --- a/app/Nova/Meetup.php +++ b/app/Nova/Meetup.php @@ -68,7 +68,8 @@ class Meetup extends Resource BelongsTo::make(__('City'), 'city', City::class)->searchable(), - BelongsTo::make(__('Created By'), 'createdBy', User::class)->onlyOnIndex(), + BelongsTo::make(__('Created By'), 'createdBy', User::class) + ->exceptOnForms(), ]; } diff --git a/app/Nova/MeetupEvent.php b/app/Nova/MeetupEvent.php index 3069ad3f..1d63e8b4 100644 --- a/app/Nova/MeetupEvent.php +++ b/app/Nova/MeetupEvent.php @@ -74,7 +74,8 @@ class MeetupEvent extends Resource BelongsTo::make('Meetup') ->searchable(), - BelongsTo::make(__('Created By'), 'createdBy', User::class)->onlyOnIndex(), + BelongsTo::make(__('Created By'), 'createdBy', User::class) + ->exceptOnForms(), ]; } diff --git a/app/Nova/OrangePill.php b/app/Nova/OrangePill.php index e206c92f..9e61319b 100644 --- a/app/Nova/OrangePill.php +++ b/app/Nova/OrangePill.php @@ -68,6 +68,7 @@ class OrangePill extends Resource ->rules('required', 'integer'), BelongsTo::make('User'), + BelongsTo::make('BookCase'), ]; diff --git a/app/Nova/Podcast.php b/app/Nova/Podcast.php index 783b7f46..a5176133 100644 --- a/app/Nova/Podcast.php +++ b/app/Nova/Podcast.php @@ -94,7 +94,8 @@ class Podcast extends Resource HasMany::make(__('Episodes'), 'episodes', Episode::class), - BelongsTo::make(__('Created By'), 'createdBy', User::class)->onlyOnIndex(), + BelongsTo::make(__('Created By'), 'createdBy', User::class) + ->exceptOnForms(), ]; } diff --git a/app/Nova/Registration.php b/app/Nova/Registration.php index ab271265..126c9093 100644 --- a/app/Nova/Registration.php +++ b/app/Nova/Registration.php @@ -59,6 +59,7 @@ class Registration extends Resource ->rules('required'), BelongsTo::make('Course Event', 'courseEvent'), + BelongsTo::make('Participant'), ]; diff --git a/app/Nova/Venue.php b/app/Nova/Venue.php index 78bbbb16..39658997 100644 --- a/app/Nova/Venue.php +++ b/app/Nova/Venue.php @@ -75,7 +75,8 @@ class Venue extends Resource BelongsTo::make(__('City'), 'city', City::class), - BelongsTo::make(__('Created By'), 'createdBy', User::class)->onlyOnIndex(), + BelongsTo::make(__('Created By'), 'createdBy', User::class) + ->exceptOnForms(), ]; }