29 lines
593 B
PHP
29 lines
593 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class CommentPostRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
$rules = [
|
|
'commentable_id' => 'required|integer',
|
|
'commentable_type' => 'required|string|in:tour,flight',
|
|
'body' => 'required|string|max:1000',
|
|
];
|
|
|
|
if (!auth()->check()) {
|
|
$rules['guest_name'] = 'required|string|max:150';
|
|
}
|
|
|
|
return $rules;
|
|
}
|
|
}
|