mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-11-14 01:58:49 +01:00
28 lines
668 B
PHP
28 lines
668 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Concerns\Http\Requests\Api;
|
|
|
|
use App\Contracts\Http\Api\Schema\SchemaInterface;
|
|
use App\Http\Api\Include\AllowedInclude;
|
|
use Illuminate\Support\Arr;
|
|
|
|
trait ValidatesIncludes
|
|
{
|
|
use ValidatesParameters;
|
|
|
|
/**
|
|
* Restrict the allowed values for the schema includes.
|
|
*
|
|
* @return array<string, array>
|
|
*/
|
|
protected function restrictAllowedIncludeValues(string $param, SchemaInterface $schema): array
|
|
{
|
|
return $this->restrictAllowedValues(
|
|
$param,
|
|
Arr::map($schema->allowedIncludes(), fn (AllowedInclude $include): string => $include->path())
|
|
);
|
|
}
|
|
}
|