taktik - laravel
This commit is contained in:
41
app/Http/Requests/Category/DestroyCategoryRequest.php
Normal file
41
app/Http/Requests/Category/DestroyCategoryRequest.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Category;
|
||||
|
||||
use App\Http\Requests\InvalidDataResponseTrait;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class DestroyCategoryRequest extends FormRequest
|
||||
{
|
||||
use InvalidDataResponseTrait;
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function all($keys = null): array
|
||||
{
|
||||
$request = parent::all($keys);
|
||||
|
||||
$request['id'] = $this->route('id');
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'id' => 'required|integer|min:0',
|
||||
];
|
||||
}
|
||||
}
|
||||
74
app/Http/Requests/Category/ListCategoryRequest.php
Normal file
74
app/Http/Requests/Category/ListCategoryRequest.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Category;
|
||||
|
||||
use App\Http\Requests\InvalidDataResponseTrait;
|
||||
use App\Services\QueryRequestModifiers\Category\CategoryFilter;
|
||||
use App\Services\QueryRequestModifiers\Category\CategoryFilterDTO;
|
||||
use App\Services\QueryRequestModifiers\Category\CategoryOrder;
|
||||
use App\Services\QueryRequestModifiers\Category\CategoryOrderDTO;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ListCategoryRequest extends FormRequest
|
||||
{
|
||||
use InvalidDataResponseTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly CategoryOrder $categoryOrder,
|
||||
private readonly CategoryFilter $categoryFilter,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function all($keys = null): array
|
||||
{
|
||||
$request = parent::all($keys);
|
||||
|
||||
$request['page'] = $this->route('page');
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'page' => 'required|integer|min:1',
|
||||
... $this->categoryOrder->validateRules(),
|
||||
... $this->categoryFilter->validateRules()
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'page' => 'page number',
|
||||
];
|
||||
}
|
||||
|
||||
public function filters(): ?CategoryFilterDTO
|
||||
{
|
||||
return $this->categoryFilter->makeFromRequest($this);
|
||||
}
|
||||
|
||||
public function order(): ?CategoryOrderDTO
|
||||
{
|
||||
return $this->categoryOrder->makeFromRequest($this);
|
||||
}
|
||||
}
|
||||
45
app/Http/Requests/Category/ShowCategoryRequest.php
Normal file
45
app/Http/Requests/Category/ShowCategoryRequest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Category;
|
||||
|
||||
use App\Http\Requests\InvalidDataResponseTrait;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ShowCategoryRequest extends FormRequest
|
||||
{
|
||||
use InvalidDataResponseTrait;
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function all($keys = null): array
|
||||
{
|
||||
$request = parent::all($keys);
|
||||
|
||||
$request['id'] = $this->route('id');
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'id' => 'required|integer|min:0',
|
||||
];
|
||||
}
|
||||
}
|
||||
47
app/Http/Requests/Category/StoreCategoryRequest.php
Normal file
47
app/Http/Requests/Category/StoreCategoryRequest.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Category;
|
||||
|
||||
use App\Http\Requests\InvalidDataResponseTrait;
|
||||
use App\Http\Resources\CategoryResource;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreCategoryRequest extends FormRequest
|
||||
{
|
||||
use InvalidDataResponseTrait;
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return static::rulesDefinition();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function rulesDefinition(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string',
|
||||
];
|
||||
}
|
||||
|
||||
public function getCategory(): CategoryResource
|
||||
{
|
||||
return CategoryResource::make($this->all());
|
||||
}
|
||||
}
|
||||
47
app/Http/Requests/Category/UpdateCategoryRequest.php
Normal file
47
app/Http/Requests/Category/UpdateCategoryRequest.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Category;
|
||||
|
||||
use App\Http\Requests\InvalidDataResponseTrait;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateCategoryRequest extends FormRequest
|
||||
{
|
||||
use InvalidDataResponseTrait;
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function all($keys = null): array
|
||||
{
|
||||
$request = parent::all($keys);
|
||||
|
||||
$request['id'] = $this->route('id');
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
...StoreCategoryRequest::rulesDefinition(),
|
||||
'id' => 'required|integer|min:0',
|
||||
];
|
||||
}
|
||||
}
|
||||
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',
|
||||
];
|
||||
}
|
||||
}
|
||||
77
app/Http/Requests/Comment/ListCommentRequest.php
Normal file
77
app/Http/Requests/Comment/ListCommentRequest.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Comment;
|
||||
|
||||
use App\Http\Requests\InvalidDataResponseTrait;
|
||||
use App\Services\QueryRequestModifiers\Comment\CommentFilter;
|
||||
use App\Services\QueryRequestModifiers\Comment\CommentFilterDTO;
|
||||
use App\Services\QueryRequestModifiers\Comment\CommentOrder;
|
||||
use App\Services\QueryRequestModifiers\Comment\CommentOrderDTO;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ListCommentRequest extends FormRequest
|
||||
{
|
||||
use InvalidDataResponseTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly CommentOrder $commentOrder,
|
||||
private readonly CommentFilter $commentFilter,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function all($keys = null): array
|
||||
{
|
||||
$request = parent::all($keys);
|
||||
|
||||
$request['page'] = $this->route('page');
|
||||
$request['post_id'] = $this->route('post_id');
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'page' => 'required|integer|min:1',
|
||||
'post_id' => 'required|integer|min:0',
|
||||
... $this->commentFilter->validateRules(),
|
||||
... $this->commentOrder->validateRules()
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'page' => 'page number',
|
||||
'post_id' => 'post id',
|
||||
];
|
||||
}
|
||||
|
||||
public function filters(): ?CommentFilterDTO
|
||||
{
|
||||
return $this->commentFilter->makeFromRequest($this);
|
||||
}
|
||||
|
||||
public function order(): ?CommentOrderDTO
|
||||
{
|
||||
return $this->commentOrder->makeFromRequest($this);
|
||||
}
|
||||
}
|
||||
49
app/Http/Requests/Comment/StoreCommentRequest.php
Normal file
49
app/Http/Requests/Comment/StoreCommentRequest.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Comment;
|
||||
|
||||
use App\Http\Requests\InvalidDataResponseTrait;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreCommentRequest extends FormRequest
|
||||
{
|
||||
use InvalidDataResponseTrait;
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function all($keys = null): array
|
||||
{
|
||||
$request = parent::all($keys);
|
||||
|
||||
$request['post_id'] = $this->route('post_id');
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return static::rulesDefinition();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function rulesDefinition()
|
||||
{
|
||||
return [
|
||||
'content' => 'required|string',
|
||||
'post_id' => 'required|exists:posts,id',
|
||||
];
|
||||
}
|
||||
}
|
||||
46
app/Http/Requests/Comment/UpdateCommentRequest.php
Normal file
46
app/Http/Requests/Comment/UpdateCommentRequest.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Comment;
|
||||
|
||||
use App\Http\Requests\InvalidDataResponseTrait;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateCommentRequest 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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
...StoreCommentRequest::rulesDefinition(),
|
||||
'id' => 'required|integer|exists:comments,id',
|
||||
];
|
||||
}
|
||||
}
|
||||
35
app/Http/Requests/InvalidDataResponseTrait.php
Normal file
35
app/Http/Requests/InvalidDataResponseTrait.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||
use OpenApi\Annotations as OA;
|
||||
|
||||
/**
|
||||
* @OA\Schema(
|
||||
* schema="ValidationError",
|
||||
* type="object",
|
||||
* @OA\Property(property="message", type="string", example="The given data was invalid."),
|
||||
* @OA\Property(
|
||||
* property="errors",
|
||||
* type="object",
|
||||
* @OA\AdditionalProperties(
|
||||
* type="array",
|
||||
* @OA\Items(type="string", example="The title field is required.")
|
||||
* )
|
||||
* )
|
||||
* )
|
||||
*/
|
||||
trait InvalidDataResponseTrait
|
||||
{
|
||||
protected function failedValidation(Validator $validator): void
|
||||
{
|
||||
throw new HttpResponseException(response()->json([
|
||||
'message' => 'Invalid data.',
|
||||
'errors' => $validator->errors(),
|
||||
], 422));
|
||||
}
|
||||
}
|
||||
41
app/Http/Requests/Post/DestroyPostRequest.php
Normal file
41
app/Http/Requests/Post/DestroyPostRequest.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Post;
|
||||
|
||||
use App\Http\Requests\InvalidDataResponseTrait;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class DestroyPostRequest extends FormRequest
|
||||
{
|
||||
use InvalidDataResponseTrait;
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function all($keys = null): array
|
||||
{
|
||||
$request = parent::all($keys);
|
||||
|
||||
$request['id'] = $this->route('id');
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'id' => 'required|integer|min:0',
|
||||
];
|
||||
}
|
||||
}
|
||||
73
app/Http/Requests/Post/ListPostRequest.php
Normal file
73
app/Http/Requests/Post/ListPostRequest.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Post;
|
||||
|
||||
use App\Http\Requests\InvalidDataResponseTrait;
|
||||
use App\Services\QueryRequestModifiers\Post\PostFilter;
|
||||
use App\Services\QueryRequestModifiers\Post\PostFilterDTO;
|
||||
use App\Services\QueryRequestModifiers\Post\PostOrder;
|
||||
use App\Services\QueryRequestModifiers\Post\PostOrderDTO;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ListPostRequest extends FormRequest
|
||||
{
|
||||
use InvalidDataResponseTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly PostOrder $postOrder,
|
||||
private readonly PostFilter $postFilter,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function all($keys = null): array
|
||||
{
|
||||
$request = parent::all($keys);
|
||||
|
||||
$request['page'] = $this->route('page');
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'page' => 'required|integer|min:1',
|
||||
... $this->postFilter->validateRules(),
|
||||
... $this->postOrder->validateRules()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'page' => 'page number',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function filters(): ?PostFilterDTO
|
||||
{
|
||||
return $this->postFilter->makeFromRequest($this);
|
||||
}
|
||||
|
||||
public function order(): ?PostOrderDTO
|
||||
{
|
||||
return $this->postOrder->makeFromRequest($this);
|
||||
}
|
||||
}
|
||||
45
app/Http/Requests/Post/ShowPostRequest.php
Normal file
45
app/Http/Requests/Post/ShowPostRequest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Post;
|
||||
|
||||
use App\Http\Requests\InvalidDataResponseTrait;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ShowPostRequest extends FormRequest
|
||||
{
|
||||
use InvalidDataResponseTrait;
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function all($keys = null): array
|
||||
{
|
||||
$request = parent::all($keys);
|
||||
|
||||
$request['id'] = $this->route('id');
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'id' => 'required|integer|min:0',
|
||||
];
|
||||
}
|
||||
}
|
||||
50
app/Http/Requests/Post/StorePostRequest.php
Normal file
50
app/Http/Requests/Post/StorePostRequest.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Post;
|
||||
|
||||
use App\Http\Requests\InvalidDataResponseTrait;
|
||||
use App\Http\Resources\PostResource;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StorePostRequest extends FormRequest
|
||||
{
|
||||
use InvalidDataResponseTrait;
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return static::rulesDefinition();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function rulesDefinition(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'required|string|max:255',
|
||||
'content' => 'required|string',
|
||||
'category_id' => 'nullable|exists:categories,id',
|
||||
'tags' => 'nullable|array',
|
||||
];
|
||||
}
|
||||
|
||||
public function getPost(): PostResource
|
||||
{
|
||||
return PostResource::make($this->all());
|
||||
}
|
||||
}
|
||||
47
app/Http/Requests/Post/UpdatePostRequest.php
Normal file
47
app/Http/Requests/Post/UpdatePostRequest.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Requests\Post;
|
||||
|
||||
use App\Http\Requests\InvalidDataResponseTrait;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdatePostRequest extends FormRequest
|
||||
{
|
||||
use InvalidDataResponseTrait;
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function all($keys = null): array
|
||||
{
|
||||
$request = parent::all($keys);
|
||||
|
||||
$request['id'] = $this->route('id');
|
||||
|
||||
return $request;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
...StorePostRequest::rulesDefinition(),
|
||||
'id' => 'required|integer|min:0',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user