Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Push one or more elements onto the end of array
<?php array_push(array &$array, mixed ...$values): int
<?php $rules = [];
if (!in_array('nullable', $column->modifiers())) {
array_push($rules, 'required');
}
<?php if (in_array($column->dataType(), ['string', 'char', 'text', 'longText', 'fullText'])) {
array_push($rules, self::overrideStringRuleForSpecialNames($column->name()));
}
if ($column->dataType() === 'id' && ($column->attributes() || Str::endsWith($column->name(), '_id'))) {
<?php }
if (in_array($column->dataType(), self::INTEGER_TYPES)) {
array_push($rules, 'integer');
if (Str::startsWith($column->dataType(), 'unsigned')) {
array_push($rules, 'gt:0');
<?php array_push($rules, 'integer');
if (Str::startsWith($column->dataType(), 'unsigned')) {
array_push($rules, 'gt:0');
}
}
<?php }
if (in_array($column->dataType(), ['json'])) {
array_push($rules, 'json');
}
if (in_array($column->dataType(), ['decimal', 'double', 'float', 'unsignedDecimal'])) {
<?php }
if (in_array($column->dataType(), ['decimal', 'double', 'float', 'unsignedDecimal'])) {
array_push($rules, 'numeric');
if (Str::startsWith($column->dataType(), 'unsigned') || in_array('unsigned', $column->modifiers())) {
array_push($rules, 'gt:0');
<?php array_push($rules, 'numeric');
if (Str::startsWith($column->dataType(), 'unsigned') || in_array('unsigned', $column->modifiers())) {
array_push($rules, 'gt:0');
}
if (!empty($column->attributes())) {
<?php }
if (!empty($column->attributes())) {
array_push($rules, self::betweenRuleForColumn($column));
}
}
<?php }
if (in_array($column->dataType(), ['enum', 'set'])) {
array_push($rules, 'in:' . implode(',', $column->attributes()));
}
if (in_array($column->dataType(), ['date', 'datetime', 'datetimetz'])) {
<?php }
if (in_array($column->dataType(), ['date', 'datetime', 'datetimetz'])) {
array_push($rules, 'date');
}
if ($column->attributes()) {
<?php if ($column->attributes()) {
if (in_array($column->dataType(), ['string', 'char'])) {
array_push($rules, 'max:' . implode($column->attributes()));
}
}
<?php }
if (in_array('unique', $column->modifiers())) {
array_push($rules, 'unique:' . $context . ',' . $column->name());
}
return $rules;