Files
animethemes-server/app/Http/Api/Field/Admin/Dump/DumpPathField.php
T
paranarimasu 128b90dae2 refactor(api): provide query to field to determine selection and aggregation (#512)
* refactor(api): provide query to field to determine selection and aggregation

* style: fix StyleCI findings
2023-02-01 23:31:55 -06:00

60 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Http\Api\Field\Admin\Dump;
use App\Contracts\Http\Api\Field\CreatableField;
use App\Contracts\Http\Api\Field\UpdatableField;
use App\Http\Api\Field\StringField;
use App\Http\Api\Schema\Schema;
use App\Models\Admin\Dump;
use Illuminate\Http\Request;
/**
* Class DumpPathField.
*/
class DumpPathField extends StringField implements CreatableField, UpdatableField
{
/**
* Create a new field instance.
*
* @param Schema $schema
*/
public function __construct(Schema $schema)
{
parent::__construct($schema, Dump::ATTRIBUTE_PATH);
}
/**
* Set the creation validation rules for the field.
*
* @param Request $request
* @return array
*/
public function getCreationRules(Request $request): array
{
return [
'required',
'string',
'max:192',
];
}
/**
* Set the update validation rules for the field.
*
* @param Request $request
* @return array
*/
public function getUpdateRules(Request $request): array
{
return [
'sometimes',
'required',
'string',
'max:192',
];
}
}