Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Finds whether a variable is an array
<?php is_array(mixed $value): bool
<?php $modifiers = collect($modifiers)->reject(
fn ($modifier) => (is_array($modifier) && key($modifier) === 'foreign')
|| (is_array($modifier) && key($modifier) === 'onDelete')
|| (is_array($modifier) && key($modifier) === 'onUpdate')
|| $modifier === 'foreign'
<?php $modifiers = collect($modifiers)->reject(
fn ($modifier) => (is_array($modifier) && key($modifier) === 'foreign')
|| (is_array($modifier) && key($modifier) === 'onDelete')
|| (is_array($modifier) && key($modifier) === 'onUpdate')
|| $modifier === 'foreign'
|| ($modifier === 'nullable' && $this->isIdOrUuid($column->dataType()))
<?php $modifiers = collect($modifiers)->reject(
fn ($modifier) => (is_array($modifier) && key($modifier) === 'foreign')
|| (is_array($modifier) && key($modifier) === 'onDelete')
|| (is_array($modifier) && key($modifier) === 'onUpdate')
|| $modifier === 'foreign'
|| ($modifier === 'nullable' && $this->isIdOrUuid($column->dataType()))
);
<?php }
foreach ($modifiers as $modifier) {
if (is_array($modifier)) {
$modifierKey = key($modifier);
$modifierValue = addslashes(current($modifier));
if ($modifierKey === 'default' && ($modifierValue === 'null' || $dataType === 'boolean' || $this->isNumericDefault($dataType, $modifierValue))) {
<?php }
if (isset($columns['relationships'])) {
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 (is_null($data_type)) {
$is_foreign_key = collect($modifiers)->contains(fn ($modifier) => (is_array($modifier) && key($modifier) === 'foreign') || $modifier === 'foreign');
$data_type = $is_foreign_key ? 'id' : 'string';
}
<?php public function isForeignKey()
{
return collect($this->modifiers())->filter(fn ($modifier) => (is_array($modifier) && key($modifier) === 'foreign') || $modifier === 'foreign')->flatten()->first();
}
public function defaultValue()