update deploy
This commit is contained in:
39
app/Http/Requests/Menu/ReorderMenuRequest.php
Normal file
39
app/Http/Requests/Menu/ReorderMenuRequest.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Menu;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ReorderMenuRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array<int, string>>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'items' => ['required', 'array', 'min:1'],
|
||||
'items.*.id' => ['required', 'integer', 'exists:menus,id'],
|
||||
'items.*.order_index' => ['required', 'integer', 'min:0'],
|
||||
'items.*.parent_id' => ['nullable', 'integer', 'exists:menus,id'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'items.required' => 'Sıralama verileri zorunludur.',
|
||||
'items.*.id.required' => 'Menü ID zorunludur.',
|
||||
'items.*.id.exists' => 'Menü bulunamadı.',
|
||||
'items.*.order_index.required' => 'Sıra numarası zorunludur.',
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Http/Requests/Menu/StoreMenuRequest.php
Normal file
46
app/Http/Requests/Menu/StoreMenuRequest.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Menu;
|
||||
|
||||
use App\Enums\MenuLocation;
|
||||
use App\Enums\MenuType;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreMenuRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array<int, mixed>>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'label' => ['required', 'string', 'max:255'],
|
||||
'url' => ['required', 'string', 'max:255'],
|
||||
'location' => ['required', 'string', Rule::enum(MenuLocation::class)],
|
||||
'type' => ['required', 'string', Rule::enum(MenuType::class)],
|
||||
'parent_id' => ['nullable', 'integer', 'exists:menus,id'],
|
||||
'order_index' => ['sometimes', 'integer', 'min:0'],
|
||||
'is_active' => ['sometimes', 'boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'label.required' => 'Menü etiketi zorunludur.',
|
||||
'url.required' => 'URL zorunludur.',
|
||||
'location.required' => 'Menü konumu zorunludur.',
|
||||
'type.required' => 'Menü tipi zorunludur.',
|
||||
'parent_id.exists' => 'Üst menü bulunamadı.',
|
||||
];
|
||||
}
|
||||
}
|
||||
42
app/Http/Requests/Menu/UpdateMenuRequest.php
Normal file
42
app/Http/Requests/Menu/UpdateMenuRequest.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Menu;
|
||||
|
||||
use App\Enums\MenuLocation;
|
||||
use App\Enums\MenuType;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateMenuRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array<int, mixed>>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'label' => ['sometimes', 'string', 'max:255'],
|
||||
'url' => ['sometimes', 'string', 'max:255'],
|
||||
'location' => ['sometimes', 'string', Rule::enum(MenuLocation::class)],
|
||||
'type' => ['sometimes', 'string', Rule::enum(MenuType::class)],
|
||||
'parent_id' => ['nullable', 'integer', 'exists:menus,id'],
|
||||
'order_index' => ['sometimes', 'integer', 'min:0'],
|
||||
'is_active' => ['sometimes', 'boolean'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'parent_id.exists' => 'Üst menü bulunamadı.',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user