taktik - laravel
This commit is contained in:
43
app/Http/Requests/Comment/DestroyCommentRequest.php
Normal file
43
app/Http/Requests/Comment/DestroyCommentRequest.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Comment;
|
||||
|
||||
use App\Http\Requests\InvalidDataResponseTrait;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class DestroyCommentRequest extends FormRequest
|
||||
{
|
||||
use InvalidDataResponseTrait;
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function all($keys = null): array
|
||||
{
|
||||
$request = parent::all($keys);
|
||||
|
||||
$request['id'] = $this->route('id');
|
||||
$request['post_id'] = $this->route('post_id');
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'id' => 'required|integer|exists:comments,id',
|
||||
'post_id' => 'required|exists:posts,id',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user