public static function definedRelations(): array
{
$reflector = new ReflectionClass(get_called_class());
return collect($reflector->getMethods())
->filter(
fn($method) => !empty($method->getReturnType()) &&
str_contains(
$method->getReturnType(),
'IlluminateDatabaseEloquentRelations'
)
)
->pluck('name')
->all();
}
public static function definedRelations(): array
{
$reflector = new ReflectionClass(get_called_class());
return collect($reflector->getMethods())
->filter(
fn($method) => !empty($method->getReturnType()) &&
str_contains(
$method->getReturnType(),
'IlluminateDatabaseEloquentRelations'
)
)
->pluck('name')
->all();
}