exceptOnForms for createdBy

This commit is contained in:
Benjamin Takats
2022-12-15 14:57:28 +01:00
parent 9e43f166a3
commit 7be1194e43
15 changed files with 36 additions and 21 deletions

View File

@@ -80,7 +80,7 @@ class BitcoinEvent extends Resource
->searchable(),
BelongsTo::make(__('Created By'), 'createdBy', User::class)
->onlyOnIndex(),
->exceptOnForms(),
];
}

View File

@@ -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(),
];
}

View File

@@ -87,7 +87,7 @@ class City extends Resource
HasMany::make(__('Meetups'), 'meetups', Meetup::class),
BelongsTo::make(__('Created By'), 'createdBy', User::class)
->onlyOnIndex(),
->exceptOnForms(),
];
}

View File

@@ -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(),
];
}

View File

@@ -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(),
];
}

View File

@@ -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(),
];
}

View File

@@ -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(),
];
}

View File

@@ -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(),
];
}

View File

@@ -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(),
];
}

View File

@@ -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(),
];
}

View File

@@ -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(),
];
}

View File

@@ -68,6 +68,7 @@ class OrangePill extends Resource
->rules('required', 'integer'),
BelongsTo::make('User'),
BelongsTo::make('BookCase'),
];

View File

@@ -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(),
];
}

View File

@@ -59,6 +59,7 @@ class Registration extends Resource
->rules('required'),
BelongsTo::make('Course Event', 'courseEvent'),
BelongsTo::make('Participant'),
];

View File

@@ -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(),
];
}