23
common/Comments/CrupdateCommentRequest.php
Executable file
23
common/Comments/CrupdateCommentRequest.php
Executable file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Common\Comments;
|
||||
|
||||
use Auth;
|
||||
use Common\Core\BaseFormRequest;
|
||||
|
||||
class CrupdateCommentRequest extends BaseFormRequest
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
$required = $this->getMethod() === 'POST' ? 'required' : '';
|
||||
$ignore =
|
||||
$this->getMethod() === 'PUT' ? $this->route('comment')->id : '';
|
||||
$userId = $this->route('comment')
|
||||
? $this->route('comment')->user_id
|
||||
: Auth::id();
|
||||
|
||||
return [
|
||||
'content' => 'required|string|max:1000|min:3',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user