update deploy
This commit is contained in:
44
app/Http/Requests/Comment/StoreCommentRequest.php
Normal file
44
app/Http/Requests/Comment/StoreCommentRequest.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Comment;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreCommentRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, array<int, string>>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'commentable_type' => ['required', 'string', 'in:course,category,announcement'],
|
||||
'commentable_id' => ['required', 'integer'],
|
||||
'author_name' => ['required', 'string', 'max:255'],
|
||||
'content' => ['required', 'string', 'max:1000'],
|
||||
'rating' => ['nullable', 'integer', 'min:1', 'max:5'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'commentable_type.required' => 'Yorum tipi zorunludur.',
|
||||
'commentable_type.in' => 'Geçersiz yorum tipi.',
|
||||
'commentable_id.required' => 'Yorum hedefi zorunludur.',
|
||||
'author_name.required' => 'İsim zorunludur.',
|
||||
'content.required' => 'Yorum içeriği zorunludur.',
|
||||
'content.max' => 'Yorum en fazla 1000 karakter olabilir.',
|
||||
'rating.min' => 'Puan en az 1 olabilir.',
|
||||
'rating.max' => 'Puan en fazla 5 olabilir.',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user