Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Split a string by a string
<?php explode(string $separator, string $string, int $limit = PHP_INT_MAX): array
<?php $tokens['cache'] = $cache['models'] ?? [];
$registry = $blueprint->analyze($tokens);
$only = array_filter(explode(',', $only));
$skip = array_filter(explode(',', $skip));
$generated = $blueprint->generate($registry, $only, $skip, $overwriteMigrations);
<?php $registry = $blueprint->analyze($tokens);
$only = array_filter(explode(',', $only));
$skip = array_filter(explode(',', $skip));
$generated = $blueprint->generate($registry, $only, $skip, $overwriteMigrations);
<?php public static function extractOptions($definition)
{
$options = explode(',', preg_replace('/enum\((?P<options>(.*))\)/', '$1', $definition));
return array_map(
function ($option) {
<?php $key = 'id';
if (Str::contains($foreign, '.')) {
[$table, $key] = explode('.', $foreign);
} elseif ($foreign !== 'foreign') {
$table = $foreign;
<?php $table = Str::plural(Str::beforeLast($column_name, '_'));
$column = Str::afterLast($column_name, '_');
} elseif (Str::contains($on, '.')) {
[$table, $column] = explode('.', $on);
$table = Str::snake($table);
} elseif (Str::contains($on, '\\')) {
$table = Str::lower(Str::plural(Str::afterLast($on, '\\')));
<?php $method_name = $is_model_fqn ? Str::afterLast($reference, '\\') : Str::beforeLast($reference, '_id');
if (Str::contains($reference, ':')) {
[$foreign_reference, $column_name] = explode(':', $reference);
$method_name = Str::beforeLast($column_name, '_id');
<?php $method_name = Str::beforeLast($column_name, '_id');
if (Str::contains($foreign_reference, '.')) {
[$class, $key] = explode('.', $foreign_reference);
if ($key === 'id') {
$key = null;
<?php private function splitField($field)
{
if (Str::contains($field, '.')) {
return explode('.', $field, 2);
}
return [null, $field];
<?php $variables[] .= '$' . $data;
$conditions[] .= sprintf('$notification->%s->is($%s)', $data, $data);
} else {
[$model, $property] = explode('.', $data);
$variables[] .= '$' . $model;
$conditions[] .= sprintf('$notification->%s == $%s', $property ?? $model, str_replace('.', '->', $data()));
}
<?php $variables[] .= '$' . $data;
$conditions[] .= sprintf('$mail->%s->is($%s)', $data, $data);
} else {
[$model, $property] = explode('.', $data);
$variables[] .= '$' . $model;
$conditions[] .= sprintf('$mail->%s == $%s', $property ?? $model, str_replace('.', '->', $data()));
}
<?php $variables[] .= '$' . $data;
$conditions[] .= sprintf('$job->%s->is($%s)', $data, $data);
} else {
[$model, $property] = explode('.', $data);
$variables[] .= '$' . $model;
$conditions[] .= sprintf('$job->%s == $%s', $property ?? $model, str_replace('.', '->', $data()));
}
<?php $variables[] .= '$' . $data;
$conditions[] .= sprintf('$event->%s->is($%s)', $data, $data);
} else {
[$model, $property] = explode('.', $data);
$variables[] .= '$' . $model;
$conditions[] .= sprintf('$event->%s == $%s', $property ?? $model, str_replace('.', '->', $data()));
}
<?php $assertion .= ', [' . implode(', ', $parameters) . ']';
} elseif (Str::contains($statement->route(), '.')) {
[$model, $action] = explode('.', $statement->route());
if (in_array($action, ['edit', 'update', 'show', 'destroy'])) {
$assertion .= sprintf(", ['%s' => $%s]", $model, $model);
}
<?php private function splitField($field)
{
if (Str::contains($field, '.')) {
return explode('.', $field, 2);
}
return [null, $field];
<?php return ['index', 'create', 'store', 'show', 'edit', 'update', 'destroy'];
}
return array_map('trim', explode(',', strtolower($type)));
}
private function hasOnlyApiResourceMethods(array $methods)