Inspects Laravel Eloquent models to discover relationships and metadata. Use when building schema analyzers or dynamic model tooling in PHP applications.
// Source: https://github.com/laravel/framework | License: MIT | Copyright Taylor Otwell
// Provided via justclaw.it.com; keep this notice with the code.
<?php
namespace Illuminate\Database\Eloquent;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Collection as BaseCollection;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Str;
use ReflectionClass;
use ReflectionMethod;
use ReflectionNamedType;
use SplFileObject;
use function Illuminate\Support\enum_value;
class ModelInspector
{
/**
* The methods that can be called in a model to indicate a relation.
*
* @var list<string>
*/
protected $relationMethods = [
'hasMany',
'hasManyThrough',
'hasOneThroug
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key