mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-10-20 17:49:20 +02:00
* refactor(api): provide query to field to determine selection and aggregation * style: fix StyleCI findings
43 lines
881 B
PHP
43 lines
881 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Api\Field\Wiki\Audio;
|
|
|
|
use App\Contracts\Http\Api\Field\CreatableField;
|
|
use App\Http\Api\Field\StringField;
|
|
use App\Http\Api\Schema\Schema;
|
|
use App\Models\Wiki\Audio;
|
|
use Illuminate\Http\Request;
|
|
|
|
/**
|
|
* Class AudioFilenameField.
|
|
*/
|
|
class AudioFilenameField extends StringField implements CreatableField
|
|
{
|
|
/**
|
|
* Create a new field instance.
|
|
*
|
|
* @param Schema $schema
|
|
*/
|
|
public function __construct(Schema $schema)
|
|
{
|
|
parent::__construct($schema, Audio::ATTRIBUTE_FILENAME);
|
|
}
|
|
|
|
/**
|
|
* Set the creation validation rules for the field.
|
|
*
|
|
* @param Request $request
|
|
* @return array
|
|
*/
|
|
public function getCreationRules(Request $request): array
|
|
{
|
|
return [
|
|
'required',
|
|
'string',
|
|
'max:192',
|
|
];
|
|
}
|
|
}
|