Files
animethemes-server/app/Http/Api/Include/AllowedInclude.php
T
paranarimasuandGitHub fd2cebe3cf chore: address deprecations to validation rules in Laravel 10 (#584)
* chore: address deprecations to validation rules in Laravel 10

* style: fix StyleCI findings
2023-06-05 01:01:49 -05:00

55 lines
1003 B
PHP

<?php
declare(strict_types=1);
namespace App\Http\Api\Include;
use App\Contracts\Http\Api\Schema\SchemaInterface;
use Illuminate\Support\Str;
/**
* Class AllowedInclude.
*/
readonly class AllowedInclude
{
/**
* Create a new AllowedIncludePath instance.
*
* @param SchemaInterface $schema
* @param string $path
*/
final public function __construct(protected SchemaInterface $schema, protected string $path)
{
}
/**
* Get the schema.
*
* @return SchemaInterface
*/
public function schema(): SchemaInterface
{
return $this->schema;
}
/**
* Get the path.
*
* @return string
*/
public function path(): string
{
return $this->path;
}
/**
* Determine if the allowed include is a direct relation for the schema.
*
* @return bool
*/
public function isDirectRelation(): bool
{
return ! Str::of($this->path)->contains('.');
}
}