Skip to content

Commit

Permalink
Settings without group
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvenga committed Dec 11, 2022
1 parent ac0d153 commit 2889959
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion stubs/MoonShine/Resources/SettingGroupResource.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class SettingGroupResource extends Resource
public function rules(Model $item): array
{
return [
'slug' => 'required|max:190|regex:/^([a-z0-9\-]+)$/i|unique:laravel_site_setting_groups,slug,' . $item->getKey(),
'slug' => 'required|max:190|regex:/^([a-z0-9\-]+)$/i|unique:setting_groups,slug,' . $item->getKey(),
'hint' => 'nullable|max:190',
];
}
Expand Down
8 changes: 5 additions & 3 deletions stubs/MoonShine/Resources/SettingResource.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class SettingResource extends Resource
ID::make()->sortable(),
BelongsTo::make(
'Group',
'setting_group_id'
'setting_group_id',
new SettingGroupResource()
)->nullable()->sortable(),
Text::make('Slug', 'slug')->required()->sortable()->hint('a-z, 0-9, -'),
Text::make('Hint', 'hint')->nullable()->sortable()->hint('Не используется на сайте, только для удобства администрирования!'),
Expand All @@ -39,7 +40,7 @@ class SettingResource extends Resource
{
return [
'setting_group_id' => 'nullable|exists:setting_groups,id',
'slug' => 'required|max:190|regex:/^([a-z0-9\-]+)$/i|unique:laravel_site_setting_groups,slug,' . $item->getKey(),
'slug' => 'required|max:190|regex:/^([a-z0-9\-]+)$/i|unique:setting_groups,slug|unique:settings,slug,' . $item->getKey(),
'hint' => 'nullable|max:190',
'value' => 'required|max:190',
];
Expand All @@ -55,7 +56,8 @@ class SettingResource extends Resource
return [
BelongsTo::make(
'Group',
'setting_group_id'
'setting_group_id',
new SettingGroupResource()
)->nullable(),
];
}
Expand Down

0 comments on commit 2889959

Please sign in to comment.