File "CreateArticleRequest.php"

Full Path: /var/www/html/back/app/Domain/CreateArticleRequest.php
File size: 1.12 KB
MIME-type: text/x-php
Charset: utf-8

<?php

declare(strict_types=1);

namespace App\Domain\Article\Requests;

use App\BaseClasses\BaseApiRequest;

class CreateArticleRequest extends BaseApiRequest
{
    public static function bodyParameters(): array
    {
        return [
            'name' => ['description' => 'name'],
            'article_type' => ['description' => 'article_type'],
            'payment_limits' => ['description' => 'payment_limits'],
            'article_group_id' => ['description' => 'article_group_id'],
        ];
    }

    public static function example(): array
    {
        return [
            'name' => "test",
            'article_type' => "test_type",
            'payment_limits' => "0.0",
            'article_group_id' => 1,
        ];
    }

    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'name' => 'required|string|max:255',
            'article_type' => 'required|string|max:255',
            'payment_limits' => 'nullable',
            'article_group_id' => 'nullable|exists:article_groups,id',
            'sort' => 'nullable',
        ];
    }


}