update deploy
This commit is contained in:
61
app/Http/Requests/Course/UpdateCourseRequest.php
Normal file
61
app/Http/Requests/Course/UpdateCourseRequest.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Course;
|
||||
|
||||
use App\Enums\CourseBadge;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class UpdateCourseRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array<int, mixed>>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'category_id' => ['required', 'integer', 'exists:categories,id'],
|
||||
'slug' => ['required', 'string', 'max:255', Rule::unique('courses', 'slug')->ignore($this->route('course'))],
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
'sub' => ['nullable', 'string', 'max:255'],
|
||||
'desc' => ['required', 'string'],
|
||||
'long_desc' => ['required', 'string'],
|
||||
'duration' => ['required', 'string', 'max:255'],
|
||||
'students' => ['nullable', 'integer', 'min:0'],
|
||||
'rating' => ['nullable', 'numeric', 'min:0', 'max:5'],
|
||||
'badge' => ['nullable', 'string', Rule::enum(CourseBadge::class)],
|
||||
'image' => ['nullable', 'string', 'max:255'],
|
||||
'price' => ['nullable', 'string', 'max:255'],
|
||||
'includes' => ['nullable', 'array'],
|
||||
'includes.*' => ['string'],
|
||||
'requirements' => ['nullable', 'array'],
|
||||
'requirements.*' => ['string'],
|
||||
'meta_title' => ['nullable', 'string', 'max:255'],
|
||||
'meta_description' => ['nullable', 'string'],
|
||||
'scope' => ['nullable', 'array'],
|
||||
'scope.*' => ['string'],
|
||||
'standard' => ['nullable', 'string', 'max:255'],
|
||||
'language' => ['nullable', 'string', 'max:255'],
|
||||
'location' => ['nullable', 'string', 'max:255'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'category_id.required' => 'Kategori seçimi zorunludur.',
|
||||
'category_id.exists' => 'Seçilen kategori bulunamadı.',
|
||||
'slug.required' => 'Slug alanı zorunludur.',
|
||||
'slug.unique' => 'Bu slug zaten kullanılıyor.',
|
||||
'title.required' => 'Eğitim başlığı zorunludur.',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user