Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Make a string lowercase
<?php strtolower(string $string): string
<?php $content = preg_replace_callback(
'/^(\s+)(id|timestamps(Tz)?|softDeletes(Tz)?)$/mi',
fn ($matches) => $matches[1] . strtolower($matches[2]) . ': ' . $matches[2],
$content
);
<?php $content = preg_replace_callback(
'/^(\s+)(id|timestamps(Tz)?|softDeletes(Tz)?): true$/mi',
fn ($matches) => $matches[1] . strtolower($matches[2]) . ': ' . $matches[2],
$content
);
<?php );
sort($segments);
return strtolower(implode('_', $segments));
}
protected function getPolyTableName(string $parentTable)
<?php return collect(self::UNSIGNABLE_TYPES)
->contains(
fn ($value) => strtolower($value) === strtolower($type)
);
}
<?php $relation = Str::lower($is_model_fqn ? Str::singular(Str::afterLast($column_name, '\\')) : Str::singular($column_name)) . 'able';
$relationship = sprintf('$this->%s(%s::class, \'%s\')', $type, $fqcn, $relation);
} elseif ($type === 'morphedByMany') {
$relationship = sprintf('$this->%s(%s::class, \'%sable\')', $type, $fqcn, strtolower($model->name()));
} elseif (!is_null($key)) {
$relationship = sprintf('$this->%s(%s::class, \'%s\', \'%s\')', $type, $fqcn, $column_name, $key);
} elseif (!is_null($class) && $type === 'belongsToMany') {
<?php }
if (in_array($column->dataType(), ['boolean', 'double', 'float'])) {
return strtolower($column->dataType());
}
if (in_array($column->dataType(), ['decimal', 'unsignedDecimal'])) {
<?php 'year' => 'int',
];
return $php_data_types[strtolower($dataType)] ?? 'string';
}
private function fullyQualifyModelReference(string $model_name)
<?php return ['index', 'create', 'store', 'show', 'edit', 'update', 'destroy'];
}
return array_map('trim', explode(',', strtolower($type)));
}
private function hasOnlyApiResourceMethods(array $methods)
<?php if (is_array($columns['relationships'])) {
foreach ($columns['relationships'] as $type => $relationships) {
foreach (explode(',', $relationships) as $reference) {
$model->addRelationship(self::$relationships[strtolower($type)], trim($reference));
}
}
}
<?php if (isset($parts[1])) {
$attributes = [$parts[1]];
}
} elseif (isset(self::$dataTypes[strtolower($value)])) {
$attributes = $parts[1] ?? null;
$data_type = self::$dataTypes[strtolower($value)];
if (!empty($attributes)) {
<?php }
} elseif (isset(self::$dataTypes[strtolower($value)])) {
$attributes = $parts[1] ?? null;
$data_type = self::$dataTypes[strtolower($value)];
if (!empty($attributes)) {
$attributes = explode(',', $attributes);
<?php }
}
if (isset(self::$modifiers[strtolower($value)])) {
$modifierAttributes = $parts[1] ?? null;
if (is_null($modifierAttributes)) {
$modifiers[] = self::$modifiers[strtolower($value)];
<?php if (isset(self::$modifiers[strtolower($value)])) {
$modifierAttributes = $parts[1] ?? null;
if (is_null($modifierAttributes)) {
$modifiers[] = self::$modifiers[strtolower($value)];
} else {
$modifiers[] = [self::$modifiers[strtolower($value)] => preg_replace('~^[\'"]?(.*?)[\'"]?$~', '$1', $modifierAttributes)];
}
<?php if (is_null($modifierAttributes)) {
$modifiers[] = self::$modifiers[strtolower($value)];
} else {
$modifiers[] = [self::$modifiers[strtolower($value)] => preg_replace('~^[\'"]?(.*?)[\'"]?$~', '$1', $modifierAttributes)];
}
}
}