mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
23 lines
423 B
PHP
23 lines
423 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Concerns\GraphQL;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
trait BindModels
|
|
{
|
|
/**
|
|
* @template TModel of Model
|
|
*
|
|
* @param class-string<TModel> $model
|
|
* @return ?TModel
|
|
*/
|
|
protected function bind(string $model, string $column, string|int $value): ?Model
|
|
{
|
|
return $model::query()
|
|
->firstWhere($column, $value);
|
|
}
|
|
}
|