composer update

This commit is contained in:
2019-12-01 06:37:45 +00:00
parent fa199eef05
commit 3115ab75a5
3650 changed files with 72361 additions and 147137 deletions

View File

@@ -114,6 +114,7 @@
}
},
"suggest": {
"ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().",
"ext-pcntl": "Required to use all features of the queue worker.",
"ext-posix": "Required to use all features of the queue worker.",
"aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (^3.0).",

View File

@@ -10,7 +10,7 @@
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Scripts -->
<script src="{{ asset('js/app.js') }}"></script>
<script src="{{ asset('js/app.js') }}" defer></script>
<!-- Fonts -->
<link rel="dns-prefetch" href="//fonts.gstatic.com">

View File

@@ -60,7 +60,7 @@ class ResetPassword extends Notification
->subject(Lang::getFromJson('Reset Password Notification'))
->line(Lang::getFromJson('You are receiving this email because we received a password reset request for your account.'))
->action(Lang::getFromJson('Reset Password'), url(config('app.url').route('password.reset', ['token' => $this->token, 'email' => $notifiable->getEmailForPasswordReset()], false)))
->line(Lang::getFromJson('This password reset link will expire in :count minutes.', ['count' => config('auth.passwords.users.expire')]))
->line(Lang::getFromJson('This password reset link will expire in :count minutes.', ['count' => config('auth.passwords.'.config('auth.defaults.passwords').'.expire')]))
->line(Lang::getFromJson('If you did not request a password reset, no further action is required.'));
}

View File

@@ -110,9 +110,13 @@ class ArrayStore extends TaggableStore
*/
public function forget($key)
{
unset($this->storage[$key]);
if (array_key_exists($key, $this->storage)) {
unset($this->storage[$key]);
return true;
return true;
}
return false;
}
/**

View File

@@ -134,17 +134,13 @@ class Repository implements CacheContract, ArrayAccess
*/
public function getMultiple($keys, $default = null)
{
if (is_null($default)) {
return $this->many($keys);
}
$defaults = [];
foreach ($keys as $key) {
if (! isset($default[$key])) {
$default[$key] = null;
}
$defaults[$key] = $default;
}
return $this->many($default);
return $this->many($defaults);
}
/**
@@ -209,7 +205,7 @@ class Repository implements CacheContract, ArrayAccess
$seconds = $this->getSeconds($ttl);
if ($seconds <= 0) {
return $this->delete($key);
return $this->forget($key);
}
$result = $this->store->put($this->itemKey($key), $value, $seconds);
@@ -283,7 +279,7 @@ class Repository implements CacheContract, ArrayAccess
*/
public function setMultiple($values, $ttl = null)
{
return $this->putMany($values, $ttl);
return $this->putMany(is_array($values) ? $values : iterator_to_array($values), $ttl);
}
/**

View File

@@ -90,7 +90,7 @@ class CallbackEvent extends Event
*/
protected function removeMutex()
{
if ($this->description) {
if ($this->description && $this->withoutOverlapping) {
$this->mutex->forget($this);
}
}

View File

@@ -124,11 +124,13 @@ trait ManagesFrequencies
/**
* Schedule the event to run hourly at a given offset in the hour.
*
* @param int $offset
* @param array|int $offset
* @return $this
*/
public function hourlyAt($offset)
{
$offset = is_array($offset) ? implode(',', $offset) : $offset;
return $this->spliceIntoPosition(1, $offset);
}

View File

@@ -627,7 +627,7 @@ class Container implements ArrayAccess, ContainerContract
throw $e;
}
throw new EntryNotFoundException;
throw new EntryNotFoundException($id);
}
}
@@ -753,9 +753,7 @@ class Container implements ArrayAccess, ContainerContract
*/
protected function findInContextualBindings($abstract)
{
if (isset($this->contextual[end($this->buildStack)][$abstract])) {
return $this->contextual[end($this->buildStack)][$abstract];
}
return $this->contextual[end($this->buildStack)][$abstract] ?? null;
}
/**
@@ -814,9 +812,13 @@ class Container implements ArrayAccess, ContainerContract
// Once we have all the constructor's parameters we can create each of the
// dependency instances and then use the reflection instances to make a
// new instance of this class, injecting the created dependencies in.
$instances = $this->resolveDependencies(
$dependencies
);
try {
$instances = $this->resolveDependencies($dependencies);
} catch (BindingResolutionException $e) {
array_pop($this->buildStack);
throw $e;
}
array_pop($this->buildStack);
@@ -1179,7 +1181,7 @@ class Container implements ArrayAccess, ContainerContract
}
/**
* Set the globally available instance of the container.
* Get the globally available instance of the container.
*
* @return static
*/

View File

@@ -0,0 +1,25 @@
<?php
namespace Illuminate\Contracts\Redis;
interface Connector
{
/**
* Create a connection to a Redis cluster.
*
* @param array $config
* @param array $options
* @return \Illuminate\Redis\Connections\Connection
*/
public function connect(array $config, array $options);
/**
* Create a connection to a Redis instance.
*
* @param array $config
* @param array $clusterOptions
* @param array $options
* @return \Illuminate\Redis\Connections\Connection
*/
public function connectToCluster(array $config, array $clusterOptions, array $options);
}

View File

@@ -166,11 +166,11 @@ class SqlServerConnector extends Connector implements ConnectorInterface
*/
protected function buildHostString(array $config, $separator)
{
if (isset($config['port']) && ! empty($config['port'])) {
return $config['host'].$separator.$config['port'];
} else {
if (empty($config['port'])) {
return $config['host'];
}
return $config['host'].$separator.$config['port'];
}
/**

View File

@@ -1,6 +1,6 @@
<?php
/* @var $factory \Illuminate\Database\Eloquent\Factory */
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use NamespacedDummyModel;
use Faker\Generator as Faker;

View File

@@ -71,7 +71,7 @@ class Builder
* @var array
*/
protected $passthru = [
'insert', 'insertGetId', 'getBindings', 'toSql', 'dump', 'dd',
'insert', 'insertOrIgnore', 'insertGetId', 'insertUsing', 'getBindings', 'toSql', 'dump', 'dd',
'exists', 'doesntExist', 'count', 'min', 'max', 'avg', 'average', 'sum', 'getConnection',
];

View File

@@ -372,9 +372,7 @@ trait HasAttributes
*/
protected function getAttributeFromArray($key)
{
if (isset($this->attributes[$key])) {
return $this->attributes[$key];
}
return $this->attributes[$key] ?? null;
}
/**
@@ -625,7 +623,7 @@ trait HasAttributes
*/
protected function isDateAttribute($key)
{
return in_array($key, $this->getDates()) ||
return in_array($key, $this->getDates(), true) ||
$this->isDateCastable($key);
}

View File

@@ -373,7 +373,7 @@ class BelongsTo extends Relation
* Get the name of the relationship.
*
* @return string
* @deprecated The getRelationName() method should be used instead. Will be removed in Laravel 5.9.
* @deprecated The getRelationName() method should be used instead. Will be removed in Laravel 6.0.
*/
public function getRelation()
{

View File

@@ -203,7 +203,7 @@ trait AsPivot
/**
* Determine if the pivot model or given attributes has timestamp attributes.
*
* @param $attributes array|null
* @param array|null $attributes
* @return bool
*/
public function hasTimestampAttributes($attributes = null)

View File

@@ -220,12 +220,12 @@ trait InteractsWithPivotTable
*/
protected function updateExistingPivotUsingCustomClass($id, array $attributes, $touch)
{
$updated = $this->getCurrentlyAttachedPivots()
$pivot = $this->getCurrentlyAttachedPivots()
->where($this->foreignPivotKey, $this->parent->{$this->parentKey})
->where($this->relatedPivotKey, $this->parseId($id))
->first()
->fill($attributes)
->isDirty();
->first();
$updated = $pivot ? $pivot->fill($attributes)->isDirty() : false;
$this->newPivot([
$this->foreignPivotKey => $this->parent->{$this->parentKey},
@@ -403,7 +403,7 @@ trait InteractsWithPivotTable
* @param string $column
* @return bool
*/
protected function hasPivotColumn($column)
public function hasPivotColumn($column)
{
return in_array($column, $this->pivotColumns);
}

View File

@@ -91,7 +91,7 @@ abstract class MorphOneOrMany extends HasOneOrMany
public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
{
return parent::getRelationExistenceQuery($query, $parentQuery, $columns)->where(
$this->morphType, $this->morphClass
$query->qualifyColumn($this->getMorphType()), $this->morphClass
);
}

View File

@@ -123,7 +123,9 @@ class MorphTo extends BelongsTo
(array) ($this->morphableEagerLoads[get_class($instance)] ?? [])
));
return $query->whereIn(
$whereIn = $this->whereInMethod($instance, $ownerKey);
return $query->{$whereIn}(
$instance->getTable().'.'.$ownerKey, $this->gatherKeysByType($type)
)->get();
}

View File

@@ -192,14 +192,18 @@ class Migrator
$this->note("<comment>Migrating:</comment> {$name}");
$startTime = microtime(true);
$this->runMigration($migration, 'up');
$runTime = round(microtime(true) - $startTime, 2);
// Once we have run a migrations class, we will log that it was run in this
// repository so that we don't try to run it next time we do a migration
// in the application. A migration repository keeps the migrate order.
$this->repository->log($name, $batch);
$this->note("<info>Migrated:</info> {$name}");
$this->note("<info>Migrated:</info> {$name} ({$runTime} seconds)");
}
/**
@@ -349,14 +353,18 @@ class Migrator
return $this->pretendToRun($instance, 'down');
}
$startTime = microtime(true);
$this->runMigration($instance, 'down');
$runTime = round(microtime(true) - $startTime, 2);
// Once we have successfully run the migration "down" we will remove it from
// the migration repository so it will be considered to have not been run
// by the application then will be able to fire by any later operation.
$this->repository->delete($migration);
$this->note("<info>Rolled back:</info> {$name}");
$this->note("<info>Rolled back:</info> {$name} ({$runTime} seconds)");
}
/**

View File

@@ -182,7 +182,7 @@ class Builder
'=', '<', '>', '<=', '>=', '<>', '!=', '<=>',
'like', 'like binary', 'not like', 'ilike',
'&', '|', '^', '<<', '>>',
'rlike', 'regexp', 'not regexp',
'rlike', 'not rlike', 'regexp', 'not regexp',
'~', '~*', '!~', '!~*', 'similar to',
'not similar to', 'not ilike', '~~*', '!~~*',
];
@@ -996,16 +996,18 @@ class Builder
/**
* Add a "where null" clause to the query.
*
* @param string $column
* @param string|array $columns
* @param string $boolean
* @param bool $not
* @return $this
*/
public function whereNull($column, $boolean = 'and', $not = false)
public function whereNull($columns, $boolean = 'and', $not = false)
{
$type = $not ? 'NotNull' : 'Null';
$this->wheres[] = compact('type', 'column', 'boolean');
foreach (Arr::wrap($columns) as $column) {
$this->wheres[] = compact('type', 'column', 'boolean');
}
return $this;
}
@@ -1198,7 +1200,9 @@ class Builder
$value = $value->format('d');
}
$value = str_pad($value, 2, '0', STR_PAD_LEFT);
if (! $value instanceof Expression) {
$value = str_pad($value, 2, '0', STR_PAD_LEFT);
}
return $this->addDateBasedWhere('Day', $column, $operator, $value, $boolean);
}
@@ -1217,7 +1221,7 @@ class Builder
$value, $operator, func_num_args() === 2
);
return $this->addDateBasedWhere('Day', $column, $operator, $value, 'or');
return $this->whereDay($column, $operator, $value, 'or');
}
/**
@@ -1239,7 +1243,9 @@ class Builder
$value = $value->format('m');
}
$value = str_pad($value, 2, '0', STR_PAD_LEFT);
if (! $value instanceof Expression) {
$value = str_pad($value, 2, '0', STR_PAD_LEFT);
}
return $this->addDateBasedWhere('Month', $column, $operator, $value, $boolean);
}
@@ -1258,7 +1264,7 @@ class Builder
$value, $operator, func_num_args() === 2
);
return $this->addDateBasedWhere('Month', $column, $operator, $value, 'or');
return $this->whereMonth($column, $operator, $value, 'or');
}
/**
@@ -1297,7 +1303,7 @@ class Builder
$value, $operator, func_num_args() === 2
);
return $this->addDateBasedWhere('Year', $column, $operator, $value, 'or');
return $this->whereYear($column, $operator, $value, 'or');
}
/**
@@ -2641,6 +2647,33 @@ class Builder
);
}
/**
* Insert a new record into the database while ignoring errors.
*
* @param array $values
* @return int
*/
public function insertOrIgnore(array $values)
{
if (empty($values)) {
return 0;
}
if (! is_array(reset($values))) {
$values = [$values];
} else {
foreach ($values as $key => $value) {
ksort($value);
$values[$key] = $value;
}
}
return $this->connection->affectingStatement(
$this->grammar->compileInsertOrIgnore($this, $values),
$this->cleanBindings(Arr::flatten($values, 1))
);
}
/**
* Insert a new record and get the value of the primary key.
*
@@ -2981,11 +3014,13 @@ class Builder
/**
* Dump the current SQL and bindings.
*
* @return void
* @return $this
*/
public function dump()
{
dump($this->toSql(), $this->getBindings());
return $this;
}
/**

View File

@@ -872,6 +872,18 @@ class Grammar extends BaseGrammar
return "insert into $table ($columns) values $parameters";
}
/**
* Compile an insert ignore statement into SQL.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $values
* @return string
*/
public function compileInsertOrIgnore(Builder $query, array $values)
{
throw new RuntimeException('This database engine does not support inserting while ignoring errors.');
}
/**
* Compile an insert and get ID statement into SQL.
*
@@ -942,7 +954,7 @@ class Grammar extends BaseGrammar
*/
public function prepareBindingsForUpdate(array $bindings, array $values)
{
$cleanBindings = Arr::except($bindings, ['join', 'select']);
$cleanBindings = Arr::except($bindings, ['select', 'join']);
return array_values(
array_merge($bindings['join'], $values, Arr::flatten($cleanBindings))
@@ -970,7 +982,9 @@ class Grammar extends BaseGrammar
*/
public function prepareBindingsForDelete(array $bindings)
{
return Arr::flatten($bindings);
return Arr::flatten(
Arr::except($bindings, 'select')
);
}
/**

View File

@@ -2,7 +2,7 @@
namespace Illuminate\Database\Query\Grammars;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Database\Query\Builder;
use Illuminate\Database\Query\JsonExpression;
@@ -55,6 +55,18 @@ class MySqlGrammar extends Grammar
return $sql;
}
/**
* Compile an insert ignore statement into SQL.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $values
* @return string
*/
public function compileInsertOrIgnore(Builder $query, array $values)
{
return Str::replaceFirst('insert', 'insert ignore', $this->compileInsert($query, $values));
}
/**
* Compile a "JSON contains" statement into SQL.
*
@@ -239,21 +251,6 @@ class MySqlGrammar extends Grammar
: $this->compileDeleteWithoutJoins($query, $table, $where);
}
/**
* Prepare the bindings for a delete statement.
*
* @param array $bindings
* @return array
*/
public function prepareBindingsForDelete(array $bindings)
{
$cleanBindings = Arr::except($bindings, ['join', 'select']);
return array_values(
array_merge($bindings['join'], Arr::flatten($cleanBindings))
);
}
/**
* Compile a delete query that does not use joins.
*

View File

@@ -195,6 +195,18 @@ class PostgresGrammar extends Grammar
: parent::compileInsert($query, $values);
}
/**
* Compile an insert ignore statement into SQL.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $values
* @return string
*/
public function compileInsertOrIgnore(Builder $query, array $values)
{
return $this->compileInsert($query, $values).' on conflict do nothing';
}
/**
* Compile an insert and get ID statement into SQL.
*
@@ -205,11 +217,7 @@ class PostgresGrammar extends Grammar
*/
public function compileInsertGetId(Builder $query, $values, $sequence)
{
if (is_null($sequence)) {
$sequence = 'id';
}
return $this->compileInsert($query, $values).' returning '.$this->wrap($sequence);
return $this->compileInsert($query, $values).' returning '.$this->wrap($sequence ?: 'id');
}
/**
@@ -247,8 +255,8 @@ class PostgresGrammar extends Grammar
// When gathering the columns for an update statement, we'll wrap each of the
// columns and convert it to a parameter value. Then we will concatenate a
// list of the columns that can be added into this update query clauses.
return collect($values)->map(function ($value, $key) use ($query) {
$column = Str::after($key, $query->from.'.');
return collect($values)->map(function ($value, $key) {
$column = last(explode('.', $key));
if ($this->isJsonSelector($key)) {
return $this->compileJsonUpdateColumn($column, $value);
@@ -365,13 +373,10 @@ class PostgresGrammar extends Grammar
: $value;
})->all();
// Update statements with "joins" in Postgres use an interesting syntax. We need to
// take all of the bindings and put them on the end of this array since they are
// added to the end of the "where" clause statements as typical where clauses.
$bindingsWithoutJoin = Arr::except($bindings, 'join');
$bindingsWithoutWhere = Arr::except($bindings, ['select', 'where']);
return array_values(
array_merge($values, $bindings['join'], Arr::flatten($bindingsWithoutJoin))
array_merge($values, $bindings['where'], Arr::flatten($bindingsWithoutWhere))
);
}
@@ -403,9 +408,24 @@ class PostgresGrammar extends Grammar
return $this->wrapTable($join->table);
})->implode(', ');
$where = count($query->wheres) > 0 ? ' '.$this->compileUpdateWheres($query) : '';
$where = $this->compileUpdateWheres($query);
return trim("delete from {$table}{$using}{$where}");
return trim("delete from {$table}{$using} {$where}");
}
/**
* Prepare the bindings for a delete statement.
*
* @param array $bindings
* @return array
*/
public function prepareBindingsForDelete(array $bindings)
{
$bindingsWithoutWhere = Arr::except($bindings, ['select', 'where']);
return array_values(
array_merge($bindings['where'], Arr::flatten($bindingsWithoutWhere))
);
}
/**

View File

@@ -178,6 +178,18 @@ class SQLiteGrammar extends Grammar
: parent::compileInsert($query, $values);
}
/**
* Compile an insert ignore statement into SQL.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $values
* @return string
*/
public function compileInsertOrIgnore(Builder $query, array $values)
{
return Str::replaceFirst('insert', 'insert or ignore', $this->compileInsert($query, $values));
}
/**
* Compile an update statement into SQL.
*
@@ -189,19 +201,35 @@ class SQLiteGrammar extends Grammar
{
$table = $this->wrapTable($query->from);
$columns = collect($values)->map(function ($value, $key) use ($query) {
return $this->wrap(Str::after($key, $query->from.'.')).' = '.$this->parameter($value);
$columns = collect($values)->map(function ($value, $key) {
return $this->wrap(Str::after($key, '.')).' = '.$this->parameter($value);
})->implode(', ');
if (isset($query->joins) || isset($query->limit)) {
$selectSql = parent::compileSelect($query->select("{$query->from}.rowid"));
return "update {$table} set $columns where {$this->wrap('rowid')} in ({$selectSql})";
return $this->compileUpdateWithJoinsOrLimit($query, $columns);
}
return trim("update {$table} set {$columns} {$this->compileWheres($query)}");
}
/**
* Compile an update statement with joins or limit into SQL.
*
* @param \Illuminate\Database\Query\Builder $query
* @param string $columns
* @return string
*/
protected function compileUpdateWithJoinsOrLimit(Builder $query, $columns)
{
$segments = preg_split('/\s+as\s+/i', $query->from);
$alias = $segments[1] ?? $segments[0];
$selectSql = parent::compileSelect($query->select($alias.'.rowid'));
return "update {$this->wrapTable($query->from)} set {$columns} where {$this->wrap('rowid')} in ({$selectSql})";
}
/**
* Prepare the bindings for an update statement.
*
@@ -211,10 +239,10 @@ class SQLiteGrammar extends Grammar
*/
public function prepareBindingsForUpdate(array $bindings, array $values)
{
$cleanBindings = Arr::except($bindings, ['select', 'join']);
$cleanBindings = Arr::except($bindings, 'select');
return array_values(
array_merge($values, $bindings['join'], Arr::flatten($cleanBindings))
array_merge($values, Arr::flatten($cleanBindings))
);
}
@@ -227,9 +255,7 @@ class SQLiteGrammar extends Grammar
public function compileDelete(Builder $query)
{
if (isset($query->joins) || isset($query->limit)) {
$selectSql = parent::compileSelect($query->select("{$query->from}.rowid"));
return "delete from {$this->wrapTable($query->from)} where {$this->wrap('rowid')} in ({$selectSql})";
return $this->compileDeleteWithJoinsOrLimit($query);
}
$wheres = is_array($query->wheres) ? $this->compileWheres($query) : '';
@@ -238,18 +264,20 @@ class SQLiteGrammar extends Grammar
}
/**
* Prepare the bindings for a delete statement.
* Compile a delete statement with joins or limit into SQL.
*
* @param array $bindings
* @return array
* @param \Illuminate\Database\Query\Builder $query
* @return string
*/
public function prepareBindingsForDelete(array $bindings)
protected function compileDeleteWithJoinsOrLimit(Builder $query)
{
$cleanBindings = Arr::except($bindings, ['select', 'join']);
$segments = preg_split('/\s+as\s+/i', $query->from);
return array_values(
array_merge($bindings['join'], Arr::flatten($cleanBindings))
);
$alias = $segments[1] ?? $segments[0];
$selectSql = parent::compileSelect($query->select($alias.'.rowid'));
return "delete from {$this->wrapTable($query->from)} where {$this->wrap('rowid')} in ({$selectSql})";
}
/**

View File

@@ -405,13 +405,10 @@ class SqlServerGrammar extends Grammar
*/
public function prepareBindingsForUpdate(array $bindings, array $values)
{
// Update statements with joins in SQL Servers utilize an unique syntax. We need to
// take all of the bindings and put them on the end of this array since they are
// added to the end of the "where" clause statements as typical where clauses.
$bindingsWithoutJoin = Arr::except($bindings, 'join');
$cleanBindings = Arr::except($bindings, 'select');
return array_values(
array_merge($values, $bindings['join'], Arr::flatten($bindingsWithoutJoin))
array_merge($values, Arr::flatten($cleanBindings))
);
}

View File

@@ -1224,6 +1224,38 @@ class Blueprint
$this->index(["{$name}_type", "{$name}_id"], $indexName);
}
/**
* Add the proper columns for a polymorphic table using UUIDs.
*
* @param string $name
* @param string|null $indexName
* @return void
*/
public function uuidMorphs($name, $indexName = null)
{
$this->string("{$name}_type");
$this->uuid("{$name}_id");
$this->index(["{$name}_type", "{$name}_id"], $indexName);
}
/**
* Add nullable columns for a polymorphic table using UUIDs.
*
* @param string $name
* @param string|null $indexName
* @return void
*/
public function nullableUuidMorphs($name, $indexName = null)
{
$this->string("{$name}_type")->nullable();
$this->uuid("{$name}_id")->nullable();
$this->index(["{$name}_type", "{$name}_id"], $indexName);
}
/**
* Adds the `remember_token` column to the table.
*

View File

@@ -11,7 +11,7 @@ use Illuminate\Database\Query\Expression;
* @method ColumnDefinition autoIncrement() Set INTEGER columns as auto-increment (primary key)
* @method ColumnDefinition change() Change the column
* @method ColumnDefinition charset(string $charset) Specify a character set for the column (MySQL)
* @method ColumnDefinition collation(string $collation) Specify a collation for the column (MySQL/SQL Server)
* @method ColumnDefinition collation(string $collation) Specify a collation for the column (MySQL/PostgreSQL/SQL Server)
* @method ColumnDefinition comment(string $comment) Add a comment to the column (MySQL)
* @method ColumnDefinition default(mixed $value) Specify a "default" value for the column
* @method ColumnDefinition first() Place the column "first" in the table (MySQL)

View File

@@ -15,7 +15,7 @@ class MySqlGrammar extends Grammar
* @var array
*/
protected $modifiers = [
'Unsigned', 'VirtualAs', 'StoredAs', 'Charset', 'Collate', 'Nullable',
'Unsigned', 'Charset', 'Collate', 'VirtualAs', 'StoredAs', 'Nullable',
'Default', 'Increment', 'Comment', 'After', 'First', 'Srid',
];

View File

@@ -19,7 +19,7 @@ class PostgresGrammar extends Grammar
*
* @var array
*/
protected $modifiers = ['Increment', 'Nullable', 'Default'];
protected $modifiers = ['Collate', 'Increment', 'Nullable', 'Default'];
/**
* The columns available as serials.
@@ -879,6 +879,20 @@ class PostgresGrammar extends Grammar
return "geography($type, 4326)";
}
/**
* Get the SQL for a collation column modifier.
*
* @param \Illuminate\Database\Schema\Blueprint $blueprint
* @param \Illuminate\Support\Fluent $column
* @return string|null
*/
protected function modifyCollate(Blueprint $blueprint, Fluent $column)
{
if (! is_null($column->collation)) {
return ' collate '.$this->wrapValue($column->collation);
}
}
/**
* Get the SQL for a nullable column modifier.
*

View File

@@ -35,11 +35,13 @@ abstract class Seeder
$classes = Arr::wrap($class);
foreach ($classes as $class) {
$seeder = $this->resolve($class);
if ($silent === false && isset($this->command)) {
$this->command->getOutput()->writeln("<info>Seeding:</info> $class");
$this->command->getOutput()->writeln('<info>Seeding:</info> '.get_class($seeder));
}
$this->resolve($class)->__invoke();
$seeder->__invoke();
}
return $this;

View File

@@ -219,7 +219,7 @@ class FilesystemManager implements FactoryContract
{
$config += ['version' => 'latest'];
if ($config['key'] && $config['secret']) {
if (! empty($config['key']) && ! empty($config['secret'])) {
$config['credentials'] = Arr::only($config, ['key', 'secret', 'token']);
}

View File

@@ -29,7 +29,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*
* @var string
*/
const VERSION = '5.8.27';
const VERSION = '5.8.35';
/**
* The base path for the Laravel installation.
@@ -626,7 +626,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
// If the application has already booted, we will call this boot method on
// the provider class so it has an opportunity to do its boot logic and
// will be ready for any usage by this developer's application logic.
if ($this->booted) {
if ($this->isBooted()) {
$this->bootProvider($provider);
}
@@ -708,7 +708,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*/
public function loadDeferredProvider($service)
{
if (! isset($this->deferredServices[$service])) {
if (! $this->isDeferredService($service)) {
return;
}
@@ -740,7 +740,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
$this->register($instance = new $provider($this));
if (! $this->booted) {
if (! $this->isBooted()) {
$this->booting(function () use ($instance) {
$this->bootProvider($instance);
});
@@ -760,7 +760,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
{
$abstract = $this->getAlias($abstract);
if (isset($this->deferredServices[$abstract]) && ! isset($this->instances[$abstract])) {
if ($this->isDeferredService($abstract) && ! isset($this->instances[$abstract])) {
$this->loadDeferredProvider($abstract);
}
@@ -777,7 +777,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*/
public function bound($abstract)
{
return isset($this->deferredServices[$abstract]) || parent::bound($abstract);
return $this->isDeferredService($abstract) || parent::bound($abstract);
}
/**
@@ -797,7 +797,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*/
public function boot()
{
if ($this->booted) {
if ($this->isBooted()) {
return;
}
@@ -1128,7 +1128,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
public function registerCoreContainerAliases()
{
foreach ([
'app' => [self::class, \Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class],
'app' => [self::class, \Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class],
'auth' => [\Illuminate\Auth\AuthManager::class, \Illuminate\Contracts\Auth\Factory::class],
'auth.driver' => [\Illuminate\Contracts\Auth\Guard::class],
'blade.compiler' => [\Illuminate\View\Compilers\BladeCompiler::class],

View File

@@ -4,6 +4,7 @@ namespace Illuminate\Foundation\Auth;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Cache\RateLimiter;
use Illuminate\Auth\Events\Lockout;
use Illuminate\Support\Facades\Lang;
@@ -53,7 +54,7 @@ trait ThrottlesLogins
throw ValidationException::withMessages([
$this->username() => [Lang::get('auth.throttle', ['seconds' => $seconds])],
])->status(429);
])->status(Response::HTTP_TOO_MANY_REQUESTS);
}
/**

View File

@@ -12,6 +12,13 @@ use Symfony\Component\Debug\Exception\FatalThrowableError;
class HandleExceptions
{
/**
* Reserved memory so that errors can be displayed properly on memory exhaustion.
*
* @var string
*/
public static $reservedMemory;
/**
* The application instance.
*
@@ -27,6 +34,8 @@ class HandleExceptions
*/
public function bootstrap(Application $app)
{
self::$reservedMemory = str_repeat('x', 10240);
$this->app = $app;
error_reporting(-1);
@@ -78,6 +87,8 @@ class HandleExceptions
}
try {
self::$reservedMemory = null;
$this->getExceptionHandler()->report($e);
} catch (Exception $e) {
//

View File

@@ -42,6 +42,10 @@ class DiscoverEvents
static::classFromFile($listener, $basePath)
);
if (! $listener->isInstantiable()) {
continue;
}
foreach ($listener->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
if (! Str::is('handle*', $method->name) ||
! isset($method->getParameters()[0])) {

View File

@@ -13,6 +13,7 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ViewErrorBag;
use Whoops\Handler\HandlerInterface;
use Illuminate\Http\RedirectResponse;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Contracts\Container\Container;
@@ -24,6 +25,7 @@ use Illuminate\Http\Exceptions\HttpResponseException;
use Symfony\Component\Debug\Exception\FlattenException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Contracts\Container\BindingResolutionException;
use Symfony\Component\Console\Application as ConsoleApplication;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -350,7 +352,11 @@ class Handler implements ExceptionHandlerContract
*/
protected function whoopsHandler()
{
return (new WhoopsHandler)->forDebug();
try {
return app(HandlerInterface::class);
} catch (BindingResolutionException $e) {
return (new WhoopsHandler)->forDebug();
}
}
/**

View File

@@ -186,8 +186,8 @@ class ProviderRepository
*/
public function writeManifest($manifest)
{
if (! is_writable(dirname($this->manifestPath))) {
throw new Exception('The bootstrap/cache directory must be present and writable.');
if (! is_writable($dirname = dirname($this->manifestPath))) {
throw new Exception("The {$dirname} directory must be present and writable.");
}
$this->files->replace(

View File

@@ -294,6 +294,34 @@ trait MakesHttpRequests
return $this->json('DELETE', $uri, $data, $headers);
}
/**
* Visit the given URI with a OPTION request.
*
* @param string $uri
* @param array $data
* @param array $headers
* @return \Illuminate\Foundation\Testing\TestResponse
*/
public function option($uri, array $data = [], array $headers = [])
{
$server = $this->transformHeadersToServerVars($headers);
return $this->call('OPTION', $uri, $data, [], [], $server);
}
/**
* Visit the given URI with a OPTION request, expecting a JSON response.
*
* @param string $uri
* @param array $data
* @param array $headers
* @return \Illuminate\Foundation\Testing\TestResponse
*/
public function optionJson($uri, array $data = [], array $headers = [])
{
return $this->json('OPTION', $uri, $data, $headers);
}
/**
* Call the given URI with a JSON request.
*

View File

@@ -98,7 +98,7 @@ trait MocksApplicationServices
{
$mock = Mockery::mock(EventsDispatcherContract::class)->shouldIgnoreMissing();
$mock->shouldReceive('dispatch')->andReturnUsing(function ($called) {
$mock->shouldReceive('dispatch', 'until')->andReturnUsing(function ($called) {
$this->firedEvents[] = $called;
});

View File

@@ -5,8 +5,10 @@ namespace Illuminate\Foundation\Testing;
use Mockery;
use Carbon\Carbon;
use Carbon\CarbonImmutable;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Facade;
use Illuminate\Database\Eloquent\Model;
use Mockery\Exception\InvalidCountException;
use Illuminate\Console\Application as Artisan;
use PHPUnit\Framework\TestCase as BaseTestCase;
@@ -42,6 +44,13 @@ abstract class TestCase extends BaseTestCase
*/
protected $beforeApplicationDestroyedCallbacks = [];
/**
* The exception thrown while running an application destruction callback.
*
* @var \Throwable
*/
protected $callbackException;
/**
* Indicates if we have made it through the base setUp function.
*
@@ -136,9 +145,7 @@ abstract class TestCase extends BaseTestCase
protected function tearDown(): void
{
if ($this->app) {
foreach ($this->beforeApplicationDestroyedCallbacks as $callback) {
call_user_func($callback);
}
$this->callBeforeApplicationDestroyedCallbacks();
$this->app->flush();
@@ -160,7 +167,13 @@ abstract class TestCase extends BaseTestCase
$this->addToAssertionCount($container->mockery_getExpectationCount());
}
Mockery::close();
try {
Mockery::close();
} catch (InvalidCountException $e) {
if (! Str::contains($e->getMethodName(), ['doWrite', 'askQuestion'])) {
throw $e;
}
}
}
if (class_exists(Carbon::class)) {
@@ -175,6 +188,10 @@ abstract class TestCase extends BaseTestCase
$this->beforeApplicationDestroyedCallbacks = [];
Artisan::forgetBootstrappers();
if ($this->callbackException) {
throw $this->callbackException;
}
}
/**
@@ -202,4 +219,22 @@ abstract class TestCase extends BaseTestCase
{
$this->beforeApplicationDestroyedCallbacks[] = $callback;
}
/**
* Execute the application's pre-destruction callbacks.
*
* @return void
*/
protected function callBeforeApplicationDestroyedCallbacks()
{
foreach ($this->beforeApplicationDestroyedCallbacks as $callback) {
try {
call_user_func($callback);
} catch (\Throwable $e) {
if (! $this->callbackException) {
$this->callbackException = $e;
}
}
}
}
}

View File

@@ -8,6 +8,7 @@ use Illuminate\Support\Str;
use Illuminate\Support\Carbon;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Traits\Tappable;
use Illuminate\Support\Traits\Macroable;
use Illuminate\Foundation\Testing\Assert as PHPUnit;
use Symfony\Component\HttpFoundation\StreamedResponse;
@@ -18,7 +19,7 @@ use Illuminate\Foundation\Testing\Constraints\SeeInOrder;
*/
class TestResponse
{
use Macroable {
use Tappable, Macroable {
__call as macroCall;
}
@@ -674,15 +675,21 @@ class TestResponse
);
if (! is_int($key)) {
$hasError = false;
foreach (Arr::wrap($jsonErrors[$key]) as $jsonErrorMessage) {
if (Str::contains($jsonErrorMessage, $value)) {
return $this;
$hasError = true;
break;
}
}
PHPUnit::fail(
"Failed to find a validation error in the response for key and message: '$key' => '$value'".PHP_EOL.PHP_EOL.$errorMessage
);
if (! $hasError) {
PHPUnit::fail(
"Failed to find a validation error in the response for key and message: '$key' => '$value'".PHP_EOL.PHP_EOL.$errorMessage
);
}
}
}
@@ -912,6 +919,41 @@ class TestResponse
return $this;
}
/**
* Assert that the session has a given value in the flashed input array.
*
* @param string|array $key
* @param mixed $value
* @return $this
*/
public function assertSessionHasInput($key, $value = null)
{
if (is_array($key)) {
foreach ($key as $k => $v) {
if (is_int($k)) {
$this->assertSessionHasInput($v);
} else {
$this->assertSessionHasInput($k, $v);
}
}
return $this;
}
if (is_null($value)) {
PHPUnit::assertTrue(
$this->session()->getOldInput($key),
"Session is missing expected key [{$key}]."
);
} elseif ($value instanceof Closure) {
PHPUnit::assertTrue($value($this->session()->getOldInput($key)));
} else {
PHPUnit::assertEquals($value, $this->session()->getOldInput($key));
}
return $this;
}
/**
* Assert that the session has the given errors.
*

View File

@@ -422,8 +422,6 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
return $request;
}
$content = $request->content;
$newRequest = (new static)->duplicate(
$request->query->all(), $request->request->all(), $request->attributes->all(),
$request->cookies->all(), $request->files->all(), $request->server->all()
@@ -431,7 +429,7 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
$newRequest->headers->replace($request->headers->all());
$newRequest->content = $content;
$newRequest->content = $request->content;
$newRequest->request = $newRequest->getInputSource();

View File

@@ -50,7 +50,7 @@ trait DelegatesToResource
*/
public function offsetExists($offset)
{
return array_key_exists($offset, $this->resource);
return isset($this->resource[$offset]);
}
/**

View File

@@ -26,6 +26,9 @@
"Illuminate\\Http\\": ""
}
},
"suggest": {
"ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image()."
},
"extra": {
"branch-alias": {
"dev-master": "5.8-dev"

View File

@@ -57,10 +57,6 @@ trait ParsesLogConfiguration
*/
protected function parseChannel(array $config)
{
if (! isset($config['name'])) {
return $this->getFallbackChannelName();
}
return $config['name'];
return $config['name'] ?? $this->getFallbackChannelName();
}
}

View File

@@ -17,7 +17,7 @@
"php": "^7.1.3",
"illuminate/contracts": "5.8.*",
"illuminate/support": "5.8.*",
"monolog/monolog": "^1.11"
"monolog/monolog": "^1.12"
},
"autoload": {
"psr-4": {

View File

@@ -29,7 +29,7 @@ class MailgunTransport extends Transport
protected $domain;
/**
* The Mailgun API end-point.
* The Mailgun API endpoint.
*
* @var string
*/
@@ -187,4 +187,25 @@ class MailgunTransport extends Transport
{
return $this->domain = $domain;
}
/**
* Get the API endpoint being used by the transport.
*
* @return string
*/
public function getEndpoint()
{
return $this->endpoint;
}
/**
* Set the API endpoint being used by the transport.
*
* @param string $endpoint
* @return string
*/
public function setEndpoint($endpoint)
{
return $this->endpoint = $endpoint;
}
}

View File

@@ -109,7 +109,7 @@ class TransportManager extends Manager
*/
protected function addSesCredentials(array $config)
{
if ($config['key'] && $config['secret']) {
if (! empty($config['key']) && ! empty($config['secret'])) {
$config['credentials'] = Arr::only($config, ['key', 'secret', 'token']);
}

View File

@@ -93,6 +93,10 @@ class MailChannel
return $message->view;
}
if (property_exists($message, 'theme') && ! is_null($message->theme)) {
$this->markdown->theme($message->theme);
}
return [
'html' => $this->markdown->render($message->markdown, $message->data()),
'text' => $this->markdown->renderText($message->markdown, $message->data()),

View File

@@ -31,6 +31,13 @@ class MailMessage extends SimpleMessage implements Renderable
*/
public $markdown = 'notifications::email';
/**
* The current theme being used when generating emails.
*
* @var string|null
*/
public $theme;
/**
* The "from" information for the message.
*
@@ -134,6 +141,19 @@ class MailMessage extends SimpleMessage implements Renderable
return $this;
}
/**
* Set the theme to use with the Markdown template.
*
* @param string $theme
* @return $this
*/
public function theme($theme)
{
$this->theme = $theme;
return $this;
}
/**
* Set the from address for the mail message.
*
@@ -289,6 +309,12 @@ class MailMessage extends SimpleMessage implements Renderable
*/
public function render()
{
if (isset($this->view)) {
return Container::getInstance()->make('mailer')->render(
$this->view, $this->data()
);
}
return Container::getInstance()
->make(Markdown::class)
->render($this->markdown, $this->data());

View File

@@ -55,8 +55,8 @@ class NotificationSender
{
$this->bus = $bus;
$this->events = $events;
$this->manager = $manager;
$this->locale = $locale;
$this->manager = $manager;
}
/**

View File

@@ -43,7 +43,8 @@
@if (! empty($salutation))
{{ $salutation }}
@else
@lang('Regards'),<br>{{ config('app.name') }}
@lang('Regards'),<br>
{{ config('app.name') }}
@endif
{{-- Subcopy --}}

View File

@@ -18,7 +18,7 @@ class SqsConnector implements ConnectorInterface
{
$config = $this->getDefaultConfiguration($config);
if ($config['key'] && $config['secret']) {
if (! empty($config['key']) && ! empty($config['secret'])) {
$config['credentials'] = Arr::only($config, ['key', 'secret', 'token']);
}

View File

@@ -3,8 +3,10 @@
namespace Illuminate\Queue;
use Illuminate\Contracts\Queue\QueueableEntity;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Contracts\Database\ModelIdentifier;
use Illuminate\Contracts\Queue\QueueableCollection;
use Illuminate\Database\Eloquent\Relations\Concerns\AsPivot;
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
trait SerializesAndRestoresModelIdentifiers
@@ -67,9 +69,24 @@ trait SerializesAndRestoresModelIdentifiers
return new EloquentCollection;
}
return $this->getQueryForModelRestoration(
$collection = $this->getQueryForModelRestoration(
(new $value->class)->setConnection($value->connection), $value->id
)->useWritePdo()->get();
if (is_a($value->class, Pivot::class, true) ||
in_array(AsPivot::class, class_uses($value->class))) {
return $collection;
}
$collection = $collection->keyBy->getKey();
$collectionClass = get_class($collection);
return new $collectionClass(
collect($value->id)->map(function ($id) use ($collection) {
return $collection[$id] ?? null;
})->filter()
);
}
/**

View File

@@ -139,7 +139,13 @@ class Worker
// We will register a signal handler for the alarm signal so that we can kill this
// process if it is running too long because it has frozen. This uses the async
// signals supported in recent versions of PHP to accomplish it conveniently.
pcntl_signal(SIGALRM, function () {
pcntl_signal(SIGALRM, function () use ($job, $options) {
if ($job) {
$this->markJobAsFailedIfWillExceedMaxAttempts(
$job->getConnectionName(), $job, (int) $options->maxTries, $this->maxAttemptsExceededException($job)
);
}
$this->kill(1);
});
@@ -321,6 +327,10 @@ class Worker
$connectionName, $job, (int) $options->maxTries
);
if ($job->isDeleted()) {
return $this->raiseAfterJobEvent($connectionName, $job);
}
// Here we will fire off the job and let it process. We will catch any exceptions so
// they can be reported to the developers logs, etc. Once the job is finished the
// proper events will be fired to let any listeners know this job has finished.
@@ -402,9 +412,7 @@ class Worker
return;
}
$this->failJob($job, $e = new MaxAttemptsExceededException(
$job->resolveName().' has been attempted too many times or run too long. The job may have previously timed out.'
));
$this->failJob($job, $e = $this->maxAttemptsExceededException($job));
throw $e;
}
@@ -582,6 +590,19 @@ class Worker
exit($status);
}
/**
* Create an instance of MaxAttemptsExceededException.
*
* @param \Illuminate\Contracts\Queue\Job|null $job
* @return \Illuminate\Queue\MaxAttemptsExceededException
*/
protected function maxAttemptsExceededException($job)
{
return new MaxAttemptsExceededException(
$job->resolveName().' has been attempted too many times or run too long. The job may have previously timed out.'
);
}
/**
* Sleep the script for a given number of seconds.
*

View File

@@ -100,7 +100,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract
*
* @param string $key
* @param dynamic $dictionary
* @return int
* @return array
*/
public function hmget($key, ...$dictionary)
{
@@ -149,7 +149,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract
*
* @param string $key
* @param int $count
* @param $value $value
* @param mixed $value
* @return int|false
*/
public function lrem($key, $count, $value)
@@ -223,7 +223,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract
* @param mixed $min
* @param mixed $max
* @param array $options
* @return int
* @return array
*/
public function zrangebyscore($key, $min, $max, $options = [])
{
@@ -244,7 +244,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract
* @param mixed $min
* @param mixed $max
* @param array $options
* @return int
* @return array
*/
public function zrevrangebyscore($key, $min, $max, $options = [])
{
@@ -268,7 +268,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract
*/
public function zinterstore($output, $keys, $options = [])
{
return $this->command('zInter', [$output, $keys,
return $this->command('zinterstore', [$output, $keys,
$options['weights'] ?? null,
$options['aggregate'] ?? 'sum',
]);
@@ -284,7 +284,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract
*/
public function zunionstore($output, $keys, $options = [])
{
return $this->command('zUnion', [$output, $keys,
return $this->command('zunionstore', [$output, $keys,
$options['weights'] ?? null,
$options['aggregate'] ?? 'sum',
]);

View File

@@ -4,11 +4,14 @@ namespace Illuminate\Redis\Connectors;
use Redis;
use RedisCluster;
use LogicException;
use Illuminate\Support\Arr;
use Illuminate\Contracts\Redis\Connector;
use Illuminate\Redis\Connections\PhpRedisConnection;
use Illuminate\Support\Facades\Redis as RedisFacade;
use Illuminate\Redis\Connections\PhpRedisClusterConnection;
class PhpRedisConnector
class PhpRedisConnector implements Connector
{
/**
* Create a new clustered PhpRedis connection.
@@ -59,10 +62,18 @@ class PhpRedisConnector
*
* @param array $config
* @return \Redis
*
* @throws \LogicException
*/
protected function createClient(array $config)
{
return tap(new Redis, function ($client) use ($config) {
if ($client instanceof RedisFacade) {
throw new LogicException(
'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.'
);
}
$this->establishConnection($client, $config);
if (! empty($config['password'])) {

View File

@@ -4,10 +4,11 @@ namespace Illuminate\Redis\Connectors;
use Predis\Client;
use Illuminate\Support\Arr;
use Illuminate\Contracts\Redis\Connector;
use Illuminate\Redis\Connections\PredisConnection;
use Illuminate\Redis\Connections\PredisClusterConnection;
class PredisConnector
class PredisConnector implements Connector
{
/**
* Create a new clustered Predis connection.

View File

@@ -26,6 +26,13 @@ class RedisManager implements Factory
*/
protected $driver;
/**
* The registered custom driver creators.
*
* @var array
*/
protected $customCreators = [];
/**
* The Redis server configurations.
*
@@ -147,10 +154,16 @@ class RedisManager implements Factory
/**
* Get the connector instance for the current driver.
*
* @return \Illuminate\Redis\Connectors\PhpRedisConnector|\Illuminate\Redis\Connectors\PredisConnector
* @return \Illuminate\Contracts\Redis\Connector
*/
protected function connector()
{
$customCreator = $this->customCreators[$this->driver] ?? null;
if ($customCreator) {
return call_user_func($customCreator);
}
switch ($this->driver) {
case 'predis':
return new Connectors\PredisConnector;
@@ -215,6 +228,20 @@ class RedisManager implements Factory
$this->driver = $driver;
}
/**
* Register a custom driver creator Closure.
*
* @param string $driver
* @param \Closure $callback
* @return $this
*/
public function extend($driver, \Closure $callback)
{
$this->customCreators[$driver] = $callback->bindTo($this, $this);
return $this;
}
/**
* Pass methods onto the default Redis connection.
*

View File

@@ -167,6 +167,17 @@ class Store implements Session
return $this->attributes;
}
/**
* Get a subset of the session data.
*
* @param array $keys
* @return array
*/
public function only(array $keys)
{
return Arr::only($this->attributes, $keys);
}
/**
* Checks if a key exists.
*

View File

@@ -1258,6 +1258,17 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate
return new static(array_merge($this->items, $this->getArrayableItems($items)));
}
/**
* Recursively merge the collection with the given items.
*
* @param mixed $items
* @return static
*/
public function mergeRecursive($items)
{
return new static(array_merge_recursive($this->items, $this->getArrayableItems($items)));
}
/**
* Create a collection by using this collection for keys and another for its values.
*
@@ -1518,6 +1529,28 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate
});
}
/**
* Replace the collection items with the given items.
*
* @param mixed $items
* @return static
*/
public function replace($items)
{
return new static(array_replace($this->items, $this->getArrayableItems($items)));
}
/**
* Recursively replace the collection items with the given items.
*
* @param mixed $items
* @return static
*/
public function replaceRecursive($items)
{
return new static(array_replace_recursive($this->items, $this->getArrayableItems($items)));
}
/**
* Reverse items order.
*
@@ -2094,7 +2127,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate
} elseif ($items instanceof Jsonable) {
return json_decode($items->toJson(), true);
} elseif ($items instanceof JsonSerializable) {
return $items->jsonSerialize();
return (array) $items->jsonSerialize();
} elseif ($items instanceof Traversable) {
return iterator_to_array($items);
}

View File

@@ -172,7 +172,9 @@ abstract class Facade
return static::$resolvedInstance[$name];
}
return static::$resolvedInstance[$name] = static::$app[$name];
if (static::$app) {
return static::$resolvedInstance[$name] = static::$app[$name];
}
}
/**

View File

@@ -2,6 +2,8 @@
namespace Illuminate\Support\Facades;
use Illuminate\Contracts\Auth\PasswordBroker;
/**
* @method static string sendResetLink(array $credentials)
* @method static mixed reset(array $credentials, \Closure $callback)
@@ -17,35 +19,35 @@ class Password extends Facade
*
* @var string
*/
const RESET_LINK_SENT = 'passwords.sent';
const RESET_LINK_SENT = PasswordBroker::RESET_LINK_SENT;
/**
* Constant representing a successfully reset password.
*
* @var string
*/
const PASSWORD_RESET = 'passwords.reset';
const PASSWORD_RESET = PasswordBroker::PASSWORD_RESET;
/**
* Constant representing the user not found response.
*
* @var string
*/
const INVALID_USER = 'passwords.user';
const INVALID_USER = PasswordBroker::INVALID_USER;
/**
* Constant representing an invalid password.
*
* @var string
*/
const INVALID_PASSWORD = 'passwords.password';
const INVALID_PASSWORD = PasswordBroker::INVALID_PASSWORD;
/**
* Constant representing an invalid token.
*
* @var string
*/
const INVALID_TOKEN = 'passwords.token';
const INVALID_TOKEN = PasswordBroker::INVALID_TOKEN;
/**
* Get the registered name of the component.

View File

@@ -17,7 +17,7 @@ abstract class ServiceProvider
/**
* Indicates if loading of the provider is deferred.
*
* @deprecated Implement the \Illuminate\Contracts\Support\DeferrableProvider interface instead. Will be removed in Laravel 5.9.
* @deprecated Implement the \Illuminate\Contracts\Support\DeferrableProvider interface instead. Will be removed in Laravel 6.0.
*
* @var bool
*/
@@ -156,10 +156,8 @@ abstract class ServiceProvider
static::$publishes[$class] = array_merge(static::$publishes[$class], $paths);
if (! is_null($groups)) {
foreach ((array) $groups as $group) {
$this->addPublishGroup($group, $paths);
}
foreach ((array) $groups as $group) {
$this->addPublishGroup($group, $paths);
}
}

View File

@@ -618,38 +618,38 @@ class Str
'7' => ['⁷', '₇', '۷', ''],
'8' => ['⁸', '₈', '۸', ''],
'9' => ['⁹', '₉', '۹', ''],
'a' => ['à', 'á', 'ả', 'ã', 'ạ', 'ă', 'ắ', 'ằ', 'ẳ', 'ẵ', 'ặ', 'â', 'ấ', 'ầ', 'ẩ', 'ẫ', 'ậ', 'ā', 'ą', 'å', 'α', 'ά', 'ἀ', 'ἁ', 'ἂ', 'ἃ', 'ἄ', 'ἅ', 'ἆ', 'ἇ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ὰ', 'ά', 'ᾰ', 'ᾱ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'а', 'أ', 'အ', 'ာ', 'ါ', 'ǻ', 'ǎ', 'ª', 'ა', 'अ', 'ا', '', 'ä'],
'b' => ['б', 'β', 'ب', 'ဗ', 'ბ', ''],
'a' => ['à', 'á', 'ả', 'ã', 'ạ', 'ă', 'ắ', 'ằ', 'ẳ', 'ẵ', 'ặ', 'â', 'ấ', 'ầ', 'ẩ', 'ẫ', 'ậ', 'ā', 'ą', 'å', 'α', 'ά', 'ἀ', 'ἁ', 'ἂ', 'ἃ', 'ἄ', 'ἅ', 'ἆ', 'ἇ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ὰ', 'ά', 'ᾰ', 'ᾱ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'а', 'أ', 'အ', 'ာ', 'ါ', 'ǻ', 'ǎ', 'ª', 'ა', 'अ', 'ا', '', 'ä', 'א'],
'b' => ['б', 'β', 'ب', 'ဗ', 'ბ', '', 'ב'],
'c' => ['ç', 'ć', 'č', 'ĉ', 'ċ', ''],
'd' => ['ď', 'ð', 'đ', 'ƌ', 'ȡ', 'ɖ', 'ɗ', 'ᵭ', 'ᶁ', 'ᶑ', 'д', 'δ', 'د', 'ض', 'ဍ', 'ဒ', 'დ', ''],
'd' => ['ď', 'ð', 'đ', 'ƌ', 'ȡ', 'ɖ', 'ɗ', 'ᵭ', 'ᶁ', 'ᶑ', 'д', 'δ', 'د', 'ض', 'ဍ', 'ဒ', 'დ', '', 'ד'],
'e' => ['é', 'è', 'ẻ', 'ẽ', 'ẹ', 'ê', 'ế', 'ề', 'ể', 'ễ', 'ệ', 'ë', 'ē', 'ę', 'ě', 'ĕ', 'ė', 'ε', 'έ', 'ἐ', 'ἑ', 'ἒ', 'ἓ', 'ἔ', 'ἕ', 'ὲ', 'έ', 'е', 'ё', 'э', 'є', 'ə', 'ဧ', 'ေ', 'ဲ', 'ე', 'ए', 'إ', 'ئ', ''],
'f' => ['ф', 'φ', 'ف', 'ƒ', 'ფ', ''],
'g' => ['ĝ', 'ğ', 'ġ', 'ģ', 'г', 'ґ', 'γ', 'ဂ', 'გ', 'گ', ''],
'h' => ['ĥ', 'ħ', 'η', 'ή', 'ح', 'ه', 'ဟ', 'ှ', 'ჰ', ''],
'i' => ['í', 'ì', 'ỉ', 'ĩ', 'ị', 'î', 'ï', 'ī', 'ĭ', 'į', 'ı', 'ι', 'ί', 'ϊ', 'ΐ', 'ἰ', 'ἱ', 'ἲ', 'ἳ', 'ἴ', 'ἵ', 'ἶ', 'ἷ', 'ὶ', 'ί', 'ῐ', 'ῑ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'і', 'ї', 'и', 'ဣ', 'ိ', 'ီ', 'ည်', 'ǐ', 'ი', 'इ', 'ی', ''],
'f' => ['ф', 'φ', 'ف', 'ƒ', 'ფ', '', 'פ', 'ף'],
'g' => ['ĝ', 'ğ', 'ġ', 'ģ', 'г', 'ґ', 'γ', 'ဂ', 'გ', 'گ', '', 'ג'],
'h' => ['ĥ', 'ħ', 'η', 'ή', 'ح', 'ه', 'ဟ', 'ှ', 'ჰ', '', 'ה'],
'i' => ['í', 'ì', 'ỉ', 'ĩ', 'ị', 'î', 'ï', 'ī', 'ĭ', 'į', 'ı', 'ι', 'ί', 'ϊ', 'ΐ', 'ἰ', 'ἱ', 'ἲ', 'ἳ', 'ἴ', 'ἵ', 'ἶ', 'ἷ', 'ὶ', 'ί', 'ῐ', 'ῑ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'і', 'ї', 'и', 'ဣ', 'ိ', 'ီ', 'ည်', 'ǐ', 'ი', 'इ', 'ی', '', 'י'],
'j' => ['ĵ', 'ј', 'Ј', 'ჯ', 'ج', ''],
'k' => ['ķ', 'ĸ', 'к', 'κ', 'Ķ', 'ق', 'ك', 'က', 'კ', 'ქ', 'ک', ''],
'l' => ['ł', 'ľ', 'ĺ', 'ļ', 'ŀ', 'л', 'λ', 'ل', 'လ', 'ლ', ''],
'm' => ['м', 'μ', 'م', 'မ', 'მ', ''],
'n' => ['ñ', 'ń', 'ň', 'ņ', 'ʼn', 'ŋ', 'ν', 'н', 'ن', 'န', 'ნ', ''],
'k' => ['ķ', 'ĸ', 'к', 'κ', 'Ķ', 'ق', 'ك', 'က', 'კ', 'ქ', 'ک', '', 'ק'],
'l' => ['ł', 'ľ', 'ĺ', 'ļ', 'ŀ', 'л', 'λ', 'ل', 'လ', 'ლ', '', 'ל'],
'm' => ['м', 'μ', 'م', 'မ', 'მ', '', 'מ', 'ם'],
'n' => ['ñ', 'ń', 'ň', 'ņ', 'ʼn', 'ŋ', 'ν', 'н', 'ن', 'န', 'ნ', '', 'נ'],
'o' => ['ó', 'ò', 'ỏ', 'õ', 'ọ', 'ô', 'ố', 'ồ', 'ổ', 'ỗ', 'ộ', 'ơ', 'ớ', 'ờ', 'ở', 'ỡ', 'ợ', 'ø', 'ō', 'ő', 'ŏ', 'ο', 'ὀ', 'ὁ', 'ὂ', 'ὃ', 'ὄ', 'ὅ', 'ὸ', 'ό', 'о', 'و', 'ို', 'ǒ', 'ǿ', 'º', 'ო', 'ओ', '', 'ö'],
'p' => ['п', 'π', 'ပ', 'პ', 'پ', ''],
'p' => ['п', 'π', 'ပ', 'პ', 'پ', '', 'פ', 'ף'],
'q' => ['', ''],
'r' => ['ŕ', 'ř', 'ŗ', 'р', 'ρ', 'ر', 'რ', ''],
's' => ['ś', 'š', 'ş', 'с', 'σ', 'ș', 'ς', 'س', 'ص', 'စ', 'ſ', 'ს', ''],
't' => ['ť', 'ţ', 'т', 'τ', 'ț', 'ت', 'ط', 'ဋ', 'တ', 'ŧ', 'თ', 'ტ', ''],
'r' => ['ŕ', 'ř', 'ŗ', 'р', 'ρ', 'ر', 'რ', '', 'ר'],
's' => ['ś', 'š', 'ş', 'с', 'σ', 'ș', 'ς', 'س', 'ص', 'စ', 'ſ', 'ს', '', 'ס'],
't' => ['ť', 'ţ', 'т', 'τ', 'ț', 'ت', 'ط', 'ဋ', 'တ', 'ŧ', 'თ', 'ტ', '', 'ת'],
'u' => ['ú', 'ù', 'ủ', 'ũ', 'ụ', 'ư', 'ứ', 'ừ', 'ử', 'ữ', 'ự', 'û', 'ū', 'ů', 'ű', 'ŭ', 'ų', 'µ', 'у', 'ဉ', 'ု', 'ူ', 'ǔ', 'ǖ', 'ǘ', 'ǚ', 'ǜ', 'უ', 'उ', '', 'ў', 'ü'],
'v' => ['в', 'ვ', 'ϐ', ''],
'v' => ['в', 'ვ', 'ϐ', '', 'ו'],
'w' => ['ŵ', 'ω', 'ώ', '', 'ွ', ''],
'x' => ['χ', 'ξ', ''],
'y' => ['ý', 'ỳ', 'ỷ', 'ỹ', 'ỵ', 'ÿ', 'ŷ', 'й', 'ы', 'υ', 'ϋ', 'ύ', 'ΰ', 'ي', 'ယ', ''],
'z' => ['ź', 'ž', 'ż', 'з', 'ζ', 'ز', 'ဇ', 'ზ', ''],
'z' => ['ź', 'ž', 'ż', 'з', 'ζ', 'ز', 'ဇ', 'ზ', '', 'ז'],
'aa' => ['ع', 'आ', 'آ'],
'ae' => ['æ', 'ǽ'],
'ai' => ['ऐ'],
'ch' => ['ч', 'ჩ', 'ჭ', 'چ'],
'dj' => ['ђ', 'đ'],
'dz' => ['џ', 'ძ'],
'dz' => ['џ', 'ძ', 'דז'],
'ei' => ['ऍ'],
'gh' => ['غ', 'ღ'],
'ii' => ['ई'],
@@ -661,7 +661,7 @@ class Str
'oi' => ['ऑ'],
'oii' => ['ऒ'],
'ps' => ['ψ'],
'sh' => ['ш', 'შ', 'ش'],
'sh' => ['ш', 'შ', 'ش', 'ש'],
'shch' => ['щ'],
'ss' => ['ß'],
'sx' => ['ŝ'],
@@ -712,13 +712,13 @@ class Str
'Nj' => ['Њ'],
'Oe' => ['Œ'],
'Ps' => ['Ψ'],
'Sh' => ['Ш'],
'Sh' => ['Ш', 'ש'],
'Shch' => ['Щ'],
'Ss' => ['ẞ'],
'Th' => ['Þ', 'Θ'],
'Th' => ['Þ', 'Θ', 'ת'],
'Ts' => ['Ц'],
'Ya' => ['Я'],
'Yu' => ['Ю'],
'Ya' => ['Я', 'יא'],
'Yu' => ['Ю', 'יו'],
'Zh' => ['Ж'],
' ' => ["\xC2\xA0", "\xE2\x80\x80", "\xE2\x80\x81", "\xE2\x80\x82", "\xE2\x80\x83", "\xE2\x80\x84", "\xE2\x80\x85", "\xE2\x80\x86", "\xE2\x80\x87", "\xE2\x80\x88", "\xE2\x80\x89", "\xE2\x80\x8A", "\xE2\x80\xAF", "\xE2\x81\x9F", "\xE3\x80\x80", "\xEF\xBE\xA0"],
];
@@ -752,6 +752,12 @@ class Str
['ä', 'ö', 'ü', 'Ä', 'Ö', 'Ü'],
['ae', 'oe', 'ue', 'AE', 'OE', 'UE'],
],
'he' => [
['א', 'ב', 'ג', 'ד', 'ה', 'ו'],
['ז', 'ח', 'ט', 'י', 'כ', 'ל'],
['מ', 'נ', 'ס', 'ע', 'פ', 'צ'],
['ק', 'ר', 'ש', 'ת', 'ן', 'ץ', 'ך', 'ם', 'ף'],
],
'ro' => [
['ă', 'â', 'î', 'ș', 'ț', 'Ă', 'Â', 'Î', 'Ș', 'Ț'],
['a', 'a', 'i', 's', 't', 'A', 'A', 'I', 'S', 'T'],

View File

@@ -229,7 +229,9 @@ class QueueFake extends QueueManager implements Queue
*/
public function size($queue = null)
{
return count($this->jobs);
return collect($this->jobs)->flatten(1)->filter(function ($job) use ($queue) {
return $job['queue'] === $queue;
})->count();
}
/**

View File

@@ -80,11 +80,13 @@ trait Macroable
));
}
if (static::$macros[$method] instanceof Closure) {
return call_user_func_array(Closure::bind(static::$macros[$method], null, static::class), $parameters);
$macro = static::$macros[$method];
if ($macro instanceof Closure) {
return call_user_func_array(Closure::bind($macro, null, static::class), $parameters);
}
return call_user_func_array(static::$macros[$method], $parameters);
return $macro(...$parameters);
}
/**
@@ -110,6 +112,6 @@ trait Macroable
return call_user_func_array($macro->bindTo($this, static::class), $parameters);
}
return call_user_func_array($macro, $parameters);
return $macro(...$parameters);
}
}

View File

@@ -44,7 +44,7 @@ if (! function_exists('array_add')) {
* @param mixed $value
* @return array
*
* @deprecated Arr::add() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::add() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_add($array, $key, $value)
{
@@ -59,7 +59,7 @@ if (! function_exists('array_collapse')) {
* @param array $array
* @return array
*
* @deprecated Arr::collapse() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::collapse() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_collapse($array)
{
@@ -74,7 +74,7 @@ if (! function_exists('array_divide')) {
* @param array $array
* @return array
*
* @deprecated Arr::divide() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::divide() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_divide($array)
{
@@ -90,7 +90,7 @@ if (! function_exists('array_dot')) {
* @param string $prepend
* @return array
*
* @deprecated Arr::dot() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::dot() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_dot($array, $prepend = '')
{
@@ -106,7 +106,7 @@ if (! function_exists('array_except')) {
* @param array|string $keys
* @return array
*
* @deprecated Arr::except() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::except() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_except($array, $keys)
{
@@ -123,7 +123,7 @@ if (! function_exists('array_first')) {
* @param mixed $default
* @return mixed
*
* @deprecated Arr::first() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::first() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_first($array, callable $callback = null, $default = null)
{
@@ -139,7 +139,7 @@ if (! function_exists('array_flatten')) {
* @param int $depth
* @return array
*
* @deprecated Arr::flatten() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::flatten() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_flatten($array, $depth = INF)
{
@@ -155,7 +155,7 @@ if (! function_exists('array_forget')) {
* @param array|string $keys
* @return void
*
* @deprecated Arr::forget() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::forget() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_forget(&$array, $keys)
{
@@ -172,7 +172,7 @@ if (! function_exists('array_get')) {
* @param mixed $default
* @return mixed
*
* @deprecated Arr::get() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::get() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_get($array, $key, $default = null)
{
@@ -188,7 +188,7 @@ if (! function_exists('array_has')) {
* @param string|array $keys
* @return bool
*
* @deprecated Arr::has() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::has() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_has($array, $keys)
{
@@ -205,7 +205,7 @@ if (! function_exists('array_last')) {
* @param mixed $default
* @return mixed
*
* @deprecated Arr::last() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::last() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_last($array, callable $callback = null, $default = null)
{
@@ -221,7 +221,7 @@ if (! function_exists('array_only')) {
* @param array|string $keys
* @return array
*
* @deprecated Arr::only() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::only() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_only($array, $keys)
{
@@ -238,7 +238,7 @@ if (! function_exists('array_pluck')) {
* @param string|array|null $key
* @return array
*
* @deprecated Arr::pluck() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::pluck() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_pluck($array, $value, $key = null)
{
@@ -255,7 +255,7 @@ if (! function_exists('array_prepend')) {
* @param mixed $key
* @return array
*
* @deprecated Arr::prepend() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::prepend() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_prepend($array, $value, $key = null)
{
@@ -272,7 +272,7 @@ if (! function_exists('array_pull')) {
* @param mixed $default
* @return mixed
*
* @deprecated Arr::pull() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::pull() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_pull(&$array, $key, $default = null)
{
@@ -288,7 +288,7 @@ if (! function_exists('array_random')) {
* @param int|null $num
* @return mixed
*
* @deprecated Arr::random() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::random() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_random($array, $num = null)
{
@@ -307,7 +307,7 @@ if (! function_exists('array_set')) {
* @param mixed $value
* @return array
*
* @deprecated Arr::set() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::set() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_set(&$array, $key, $value)
{
@@ -323,7 +323,7 @@ if (! function_exists('array_sort')) {
* @param callable|string|null $callback
* @return array
*
* @deprecated Arr::sort() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::sort() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_sort($array, $callback = null)
{
@@ -338,7 +338,7 @@ if (! function_exists('array_sort_recursive')) {
* @param array $array
* @return array
*
* @deprecated Arr::sortRecursive() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::sortRecursive() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_sort_recursive($array)
{
@@ -354,7 +354,7 @@ if (! function_exists('array_where')) {
* @param callable $callback
* @return array
*
* @deprecated Arr::where() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::where() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_where($array, callable $callback)
{
@@ -369,7 +369,7 @@ if (! function_exists('array_wrap')) {
* @param mixed $value
* @return array
*
* @deprecated Arr::wrap() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Arr::wrap() should be used directly instead. Will be removed in Laravel 6.0.
*/
function array_wrap($value)
{
@@ -413,7 +413,7 @@ if (! function_exists('camel_case')) {
* @param string $value
* @return string
*
* @deprecated Str::camel() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::camel() should be used directly instead. Will be removed in Laravel 6.0.
*/
function camel_case($value)
{
@@ -622,7 +622,7 @@ if (! function_exists('ends_with')) {
* @param string|array $needles
* @return bool
*
* @deprecated Str::endsWith() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::endsWith() should be used directly instead. Will be removed in Laravel 6.0.
*/
function ends_with($haystack, $needles)
{
@@ -708,7 +708,7 @@ if (! function_exists('kebab_case')) {
* @param string $value
* @return string
*
* @deprecated Str::kebab() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::kebab() should be used directly instead. Will be removed in Laravel 6.0.
*/
function kebab_case($value)
{
@@ -839,7 +839,7 @@ if (! function_exists('snake_case')) {
* @param string $delimiter
* @return string
*
* @deprecated Str::snake() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::snake() should be used directly instead. Will be removed in Laravel 6.0.
*/
function snake_case($value, $delimiter = '_')
{
@@ -855,7 +855,7 @@ if (! function_exists('starts_with')) {
* @param string|array $needles
* @return bool
*
* @deprecated Str::startsWith() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::startsWith() should be used directly instead. Will be removed in Laravel 6.0.
*/
function starts_with($haystack, $needles)
{
@@ -871,7 +871,7 @@ if (! function_exists('str_after')) {
* @param string $search
* @return string
*
* @deprecated Str::after() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::after() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_after($subject, $search)
{
@@ -887,7 +887,7 @@ if (! function_exists('str_before')) {
* @param string $search
* @return string
*
* @deprecated Str::before() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::before() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_before($subject, $search)
{
@@ -903,7 +903,7 @@ if (! function_exists('str_contains')) {
* @param string|array $needles
* @return bool
*
* @deprecated Str::contains() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::contains() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_contains($haystack, $needles)
{
@@ -919,7 +919,7 @@ if (! function_exists('str_finish')) {
* @param string $cap
* @return string
*
* @deprecated Str::finish() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::finish() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_finish($value, $cap)
{
@@ -935,7 +935,7 @@ if (! function_exists('str_is')) {
* @param string $value
* @return bool
*
* @deprecated Str::is() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::is() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_is($pattern, $value)
{
@@ -952,7 +952,7 @@ if (! function_exists('str_limit')) {
* @param string $end
* @return string
*
* @deprecated Str::limit() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::limit() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_limit($value, $limit = 100, $end = '...')
{
@@ -968,7 +968,7 @@ if (! function_exists('str_plural')) {
* @param int $count
* @return string
*
* @deprecated Str::plural() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::plural() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_plural($value, $count = 2)
{
@@ -985,7 +985,7 @@ if (! function_exists('str_random')) {
*
* @throws \RuntimeException
*
* @deprecated Str::random() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::random() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_random($length = 16)
{
@@ -1002,7 +1002,7 @@ if (! function_exists('str_replace_array')) {
* @param string $subject
* @return string
*
* @deprecated Str::replaceArray() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::replaceArray() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_replace_array($search, array $replace, $subject)
{
@@ -1019,7 +1019,7 @@ if (! function_exists('str_replace_first')) {
* @param string $subject
* @return string
*
* @deprecated Str::replaceFirst() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::replaceFirst() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_replace_first($search, $replace, $subject)
{
@@ -1036,7 +1036,7 @@ if (! function_exists('str_replace_last')) {
* @param string $subject
* @return string
*
* @deprecated Str::replaceLast() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::replaceLast() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_replace_last($search, $replace, $subject)
{
@@ -1051,7 +1051,7 @@ if (! function_exists('str_singular')) {
* @param string $value
* @return string
*
* @deprecated Str::singular() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::singular() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_singular($value)
{
@@ -1068,7 +1068,7 @@ if (! function_exists('str_slug')) {
* @param string $language
* @return string
*
* @deprecated Str::slug() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::slug() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_slug($title, $separator = '-', $language = 'en')
{
@@ -1084,7 +1084,7 @@ if (! function_exists('str_start')) {
* @param string $prefix
* @return string
*
* @deprecated Str::start() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::start() should be used directly instead. Will be removed in Laravel 6.0.
*/
function str_start($value, $prefix)
{
@@ -1099,7 +1099,7 @@ if (! function_exists('studly_case')) {
* @param string $value
* @return string
*
* @deprecated Str::studly() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::studly() should be used directly instead. Will be removed in Laravel 6.0.
*/
function studly_case($value)
{
@@ -1175,7 +1175,7 @@ if (! function_exists('title_case')) {
* @param string $value
* @return string
*
* @deprecated Str::title() should be used directly instead. Will be removed in Laravel 5.9.
* @deprecated Str::title() should be used directly instead. Will be removed in Laravel 6.0.
*/
function title_case($value)
{

View File

@@ -0,0 +1,43 @@
<?php
namespace Illuminate\Validation\Concerns;
use Egulias\EmailValidator\EmailLexer;
use Egulias\EmailValidator\Warning\Warning;
use Egulias\EmailValidator\Exception\InvalidEmail;
use Egulias\EmailValidator\Validation\EmailValidation;
class FilterEmailValidation implements EmailValidation
{
/**
* Returns true if the given email is valid.
*
* @param string $email
* @param EmailLexer
* @return bool
*/
public function isValid($email, EmailLexer $emailLexer)
{
return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
}
/**
* Returns the validation error.
*
* @return InvalidEmail|null
*/
public function getError()
{
//
}
/**
* Returns the validation warnings.
*
* @return Warning[]
*/
public function getWarnings()
{
return [];
}
}

View File

@@ -320,6 +320,10 @@ trait FormatsMessages
return $line;
}
if (is_bool($value)) {
return $value ? 'true' : 'false';
}
return $value;
}

View File

@@ -260,7 +260,7 @@ trait ReplacesAttributes
protected function replaceGt($message, $attribute, $rule, $parameters)
{
if (is_null($value = $this->getValue($parameters[0]))) {
return str_replace(':value', $parameters[0], $message);
return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message);
}
return str_replace(':value', $this->getSize($attribute, $value), $message);
@@ -278,7 +278,7 @@ trait ReplacesAttributes
protected function replaceLt($message, $attribute, $rule, $parameters)
{
if (is_null($value = $this->getValue($parameters[0]))) {
return str_replace(':value', $parameters[0], $message);
return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message);
}
return str_replace(':value', $this->getSize($attribute, $value), $message);
@@ -296,7 +296,7 @@ trait ReplacesAttributes
protected function replaceGte($message, $attribute, $rule, $parameters)
{
if (is_null($value = $this->getValue($parameters[0]))) {
return str_replace(':value', $parameters[0], $message);
return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message);
}
return str_replace(':value', $this->getSize($attribute, $value), $message);
@@ -314,7 +314,7 @@ trait ReplacesAttributes
protected function replaceLte($message, $attribute, $rule, $parameters)
{
if (is_null($value = $this->getValue($parameters[0]))) {
return str_replace(':value', $parameters[0], $message);
return str_replace(':value', $this->getDisplayableAttribute($parameters[0]), $message);
}
return str_replace(':value', $this->getSize($attribute, $value), $message);

View File

@@ -20,6 +20,10 @@ use Egulias\EmailValidator\EmailValidator;
use Symfony\Component\HttpFoundation\File\File;
use Egulias\EmailValidator\Validation\RFCValidation;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Egulias\EmailValidator\Validation\DNSCheckValidation;
use Egulias\EmailValidator\Validation\SpoofCheckValidation;
use Egulias\EmailValidator\Validation\NoRFCWarningsValidation;
use Egulias\EmailValidator\Validation\MultipleValidationWithAnd;
trait ValidatesAttributes
{
@@ -246,7 +250,7 @@ trait ValidatesAttributes
return Date::parse($value);
}
return new DateTime($value);
return date_create($value) ?: null;
} catch (Exception $e) {
//
}
@@ -621,16 +625,35 @@ trait ValidatesAttributes
* Validate that an attribute is a valid e-mail address.
*
* @param string $attribute
* @param mixed $value
* @param mixed $value
* @param array $parameters
* @return bool
*/
public function validateEmail($attribute, $value)
public function validateEmail($attribute, $value, $parameters)
{
if (! is_string($value) && ! (is_object($value) && method_exists($value, '__toString'))) {
return false;
}
return (new EmailValidator)->isValid($value, new RFCValidation);
$validations = collect($parameters)
->unique()
->map(function ($validation) {
if ($validation === 'rfc') {
return new RFCValidation();
} elseif ($validation === 'strict') {
return new NoRFCWarningsValidation();
} elseif ($validation === 'dns') {
return new DNSCheckValidation();
} elseif ($validation === 'spoof') {
return new SpoofCheckValidation();
} elseif ($validation === 'filter') {
return new FilterEmailValidation();
}
})
->values()
->all() ?: [new RFCValidation()];
return (new EmailValidator)->isValid($value, new MultipleValidationWithAnd($validations));
}
/**
@@ -988,7 +1011,7 @@ trait ValidatesAttributes
*/
public function validateImage($attribute, $value)
{
return $this->validateMimes($attribute, $value, ['jpeg', 'png', 'gif', 'bmp', 'svg']);
return $this->validateMimes($attribute, $value, ['jpeg', 'png', 'gif', 'bmp', 'svg', 'webp']);
}
/**

View File

@@ -25,6 +25,8 @@ trait ValidatesWhenResolvedTrait
if ($instance->fails()) {
$this->failedValidation($instance);
}
$this->passedValidation();
}
/**
@@ -34,7 +36,7 @@ trait ValidatesWhenResolvedTrait
*/
protected function prepareForValidation()
{
// no default action
//
}
/**
@@ -47,6 +49,16 @@ trait ValidatesWhenResolvedTrait
return $this->validator();
}
/**
* Handle a passed validation attempt.
*
* @return void
*/
protected function passedValidation()
{
//
}
/**
* Handle a failed validation attempt.
*

View File

@@ -131,7 +131,7 @@ class ValidationRuleParser
foreach ($data as $key => $value) {
if (Str::startsWith($key, $attribute) || (bool) preg_match('/^'.$pattern.'\z/', $key)) {
foreach ((array) $rules as $rule) {
$this->implicitAttributes[$attribute][] = $key;
$this->implicitAttributes[$attribute][] = strval($key);
$results = $this->mergeRules($results, $key, $rule);
}

View File

@@ -572,7 +572,7 @@ class Validator implements ValidatorContract
if (! $rule->passes($attribute, $value)) {
$this->failedRules[$attribute][get_class($rule)] = [];
$messages = (array) $rule->message();
$messages = $rule->message() ? (array) $rule->message() : [get_class($rule)];
foreach ($messages as $message) {
$this->messages->add($attribute, $this->makeReplacements(

View File

@@ -22,6 +22,18 @@ All of your worker configuration is stored in a single, simple configuration fil
Documentation for Horizon can be found on the [Laravel website](https://laravel.com/docs/horizon).
## Contributing
Thank you for considering contributing to Horizon! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
Please review [our security policy](https://github.com/laravel/horizon/security/policy) on how to report security vulnerabilities.
## License
Laravel Horizon is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
Laravel Horizon is open-sourced software licensed under the [MIT license](LICENSE.md).

View File

@@ -15,9 +15,9 @@
"ext-pcntl": "*",
"ext-posix": "*",
"cakephp/chronos": "^1.0",
"illuminate/contracts": "~5.7.0|~5.8.0|~5.9.0",
"illuminate/queue": "~5.7.0|~5.8.0|~5.9.0",
"illuminate/support": "~5.7.0|~5.8.0|~5.9.0",
"illuminate/contracts": "~5.7.0|~5.8.0|^6.0|^7.0",
"illuminate/queue": "~5.7.0|~5.8.0|^6.0|^7.0",
"illuminate/support": "~5.7.0|~5.8.0|^6.0|^7.0",
"predis/predis": "^1.1",
"ramsey/uuid": "^3.5",
"symfony/process": "^4.2",
@@ -25,8 +25,8 @@
},
"require-dev": {
"mockery/mockery": "^1.0",
"orchestra/testbench": "^3.7",
"phpunit/phpunit": "^7.0"
"orchestra/testbench": "^3.7|^4.0|^5.0",
"phpunit/phpunit": "^7.0|^8.0"
},
"autoload": {
"psr-4": {

View File

@@ -95,6 +95,7 @@ return [
'trim' => [
'recent' => 60,
'recent_failed' => 10080,
'failed' => 10080,
'monitored' => 10080,
],
@@ -145,7 +146,7 @@ return [
'queue' => ['default'],
'balance' => 'simple',
'processes' => 10,
'tries' => 3,
'tries' => 1,
],
],
@@ -155,7 +156,7 @@ return [
'queue' => ['default'],
'balance' => 'simple',
'processes' => 3,
'tries' => 3,
'tries' => 1,
],
],
],

View File

@@ -5394,9 +5394,9 @@
}
},
"lodash": {
"version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==",
"version": "4.17.13",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.13.tgz",
"integrity": "sha512-vm3/XWXfWtRua0FkUyEHBZy8kCPjErNBT9fJx8Zvs+U6zjqPbTUOpkaoum3O5uiA8sm+yNMHXfYkTUHFoMxFNA==",
"dev": true
},
"lodash._baseassign": {
@@ -5781,9 +5781,9 @@
}
},
"mixin-deep": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz",
"integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==",
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
"integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==",
"dev": true,
"requires": {
"for-in": "^1.0.2",

View File

@@ -17,7 +17,7 @@
"highlight.js": "^9.12.0",
"jquery": "^3.4.1",
"laravel-mix": "^4.0.15",
"lodash": "^4.17.4",
"lodash": "^4.17.13",
"md5": "^2.2.1",
"moment": "^2.10.6",
"moment-timezone": "^0.5.21",

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
{
"/app.js": "/app.js?id=2f0b62afeb80a5d1877f",
"/app.js": "/app.js?id=f41217b645f8cd9ffacc",
"/app.css": "/app.css?id=b95d548aba488172f4b4",
"/app-dark.css": "/app-dark.css?id=b5b064c2f5a4b673a1c5"
}

View File

@@ -11,6 +11,8 @@ require('bootstrap');
let token = document.head.querySelector('meta[name="csrf-token"]');
axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
if (token) {
axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
}

View File

@@ -51,10 +51,10 @@
/**
* Determine the recently failed job period label.
*/
recentlyFailedPeriod() {
failedJobsPeriod() {
return !this.ready
? 'Failed jobs past 7 days'
: `Failed jobs past ${this.determinePeriod(this.stats.periods.recentlyFailed)}`;
: `Failed jobs past ${this.determinePeriod(this.stats.periods.failedJobs)}`;
},
},
@@ -184,10 +184,10 @@
<div class="w-25 border-right border-bottom">
<div class="p-4">
<small class="text-uppercase" v-text="recentlyFailedPeriod"></small>
<small class="text-uppercase" v-text="failedJobsPeriod"></small>
<h4 class="mt-4 mb-0">
{{ stats.recentlyFailed ? stats.recentlyFailed.toLocaleString() : 0 }}
{{ stats.failedJobs ? stats.failedJobs.toLocaleString() : 0 }}
</h4>
</div>
</div>

View File

@@ -7,6 +7,8 @@
*/
data() {
return {
tagSearchPhrase: '',
searchTimeout: null,
ready: false,
loadingNewEntries: false,
hasNewEntries: false,
@@ -44,6 +46,16 @@
this.page = 1;
this.loadJobs(this.$route.params.tag);
},
tagSearchPhrase() {
clearTimeout(this.searchTimeout);
clearInterval(this.interval);
this.searchTimeout = setTimeout(() => {
this.loadJobs();
this.refreshJobsPeriodically();
}, 500);
}
},
@@ -57,7 +69,9 @@
this.ready = false;
}
this.$http.get('/' + Horizon.path + '/api/jobs/recent?starting_at=' + starting + '&limit=' + this.perPage)
var tagQuery = this.tagSearchPhrase ? 'tag=' + this.tagSearchPhrase + '&' : '';
this.$http.get('/' + Horizon.path + '/api/jobs/recent?' + tagQuery + 'starting_at=' + starting + '&limit=' + this.perPage)
.then(response => {
if (!this.$root.autoLoadsNewEntries && refreshing && this.jobs.length && _.first(response.data.jobs).id !== _.first(this.jobs).id) {
this.hasNewEntries = true;
@@ -130,6 +144,8 @@
<div class="card">
<div class="card-header d-flex align-items-center justify-content-between">
<h5>Recent Jobs</h5>
<input type="text" class="form-control" v-model="tagSearchPhrase" placeholder="Search Tags" style="width:200px">
</div>
<div v-if="!ready" class="d-flex align-items-center justify-content-center card-bg-secondary p-5 bottom-radius">

View File

@@ -2,9 +2,9 @@
namespace Laravel\Horizon;
use Illuminate\Contracts\Queue\Factory as QueueFactory;
use Illuminate\Support\Collection;
use Laravel\Horizon\Contracts\MetricsRepository;
use Illuminate\Contracts\Queue\Factory as QueueFactory;
class AutoScaler
{
@@ -95,9 +95,15 @@ class AutoScaler
$timeToClearAll = $timeToClear->sum();
return $timeToClear->mapWithKeys(function ($timeToClear, $queue) use ($supervisor, $timeToClearAll) {
return $timeToClearAll > 0 && $supervisor->options->autoScaling()
? [$queue => (($timeToClear / $timeToClearAll) * $supervisor->options->maxProcesses)]
: [$queue => $supervisor->options->maxProcesses / count($supervisor->processPools)];
if ($timeToClearAll > 0 &&
$supervisor->options->autoScaling()) {
return [$queue => (($timeToClear / $timeToClearAll) * $supervisor->options->maxProcesses)];
} elseif ($timeToClearAll == 0 &&
$supervisor->options->autoScaling()) {
return [$queue => $supervisor->options->minProcesses];
}
return [$queue => $supervisor->options->maxProcesses / count($supervisor->processPools)];
})->sort();
}

View File

@@ -2,9 +2,9 @@
namespace Laravel\Horizon\Connectors;
use Illuminate\Queue\Connectors\RedisConnector as BaseConnector;
use Illuminate\Support\Arr;
use Laravel\Horizon\RedisQueue;
use Illuminate\Queue\Connectors\RedisConnector as BaseConnector;
class RedisConnector extends BaseConnector
{

View File

@@ -2,11 +2,11 @@
namespace Laravel\Horizon\Console;
use Illuminate\Console\Command;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Laravel\Horizon\MasterSupervisor;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
class ContinueCommand extends Command
{

View File

@@ -3,9 +3,9 @@
namespace Laravel\Horizon\Console;
use Illuminate\Console\Command;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Laravel\Horizon\ProvisioningPlan;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
class HorizonCommand extends Command
{

View File

@@ -2,9 +2,9 @@
namespace Laravel\Horizon\Console;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Illuminate\Console\DetectsApplicationNamespace;
use Illuminate\Support\Str;
class InstallCommand extends Command
{

View File

@@ -2,11 +2,11 @@
namespace Laravel\Horizon\Console;
use Illuminate\Console\Command;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Laravel\Horizon\MasterSupervisor;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
class PauseCommand extends Command
{

View File

@@ -2,13 +2,13 @@
namespace Laravel\Horizon\Console;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Laravel\Horizon\MasterSupervisor;
use Laravel\Horizon\ProcessInspector;
use Illuminate\Support\Str;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\Contracts\ProcessRepository;
use Laravel\Horizon\Contracts\SupervisorRepository;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
use Laravel\Horizon\ProcessInspector;
class PurgeCommand extends Command
{

View File

@@ -2,9 +2,9 @@
namespace Laravel\Horizon\Console;
use Laravel\Horizon\Lock;
use Illuminate\Console\Command;
use Laravel\Horizon\Contracts\MetricsRepository;
use Laravel\Horizon\Lock;
class SnapshotCommand extends Command
{

View File

@@ -2,13 +2,13 @@
namespace Laravel\Horizon\Console;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Laravel\Horizon\MasterSupervisor;
use Illuminate\Support\InteractsWithTime;
use Illuminate\Contracts\Cache\Factory as CacheFactory;
use Illuminate\Support\Arr;
use Illuminate\Support\InteractsWithTime;
use Illuminate\Support\Str;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\MasterSupervisor;
class TerminateCommand extends Command
{

View File

@@ -2,8 +2,8 @@
namespace Laravel\Horizon\Contracts;
use Laravel\Horizon\JobPayload;
use Illuminate\Support\Collection;
use Laravel\Horizon\JobPayload;
interface JobRepository
{

View File

@@ -13,6 +13,7 @@ trait EventMap
Events\JobPushed::class => [
Listeners\StoreJob::class,
Listeners\StoreMonitoredTags::class,
Listeners\StoreTagsForRecentJob::class,
],
Events\JobReserved::class => [

View File

@@ -2,10 +2,10 @@
namespace Laravel\Horizon;
use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Queue\QueueManager;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use Illuminate\Contracts\Events\Dispatcher;
use Laravel\Horizon\Connectors\RedisConnector;
class HorizonServiceProvider extends ServiceProvider
@@ -105,6 +105,10 @@ class HorizonServiceProvider extends ServiceProvider
define('HORIZON_PATH', realpath(__DIR__.'/../'));
}
$this->app->bind(Console\WorkCommand::class, function ($app) {
return new Console\WorkCommand($app['queue.worker'], $app['cache.store']);
});
$this->configure();
$this->offerPublishing();
$this->registerServices();

View File

@@ -2,8 +2,8 @@
namespace Laravel\Horizon\Http\Controllers;
use Laravel\Horizon\Http\Middleware\Authenticate;
use Illuminate\Routing\Controller as BaseController;
use Laravel\Horizon\Http\Middleware\Authenticate;
class Controller extends BaseController
{

View File

@@ -2,11 +2,11 @@
namespace Laravel\Horizon\Http\Controllers;
use Laravel\Horizon\WaitTimeCalculator;
use Laravel\Horizon\Contracts\JobRepository;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\Contracts\MetricsRepository;
use Laravel\Horizon\Contracts\SupervisorRepository;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\WaitTimeCalculator;
class DashboardStatsController extends Controller
{
@@ -22,13 +22,13 @@ class DashboardStatsController extends Controller
'processes' => $this->totalProcessCount(),
'queueWithMaxRuntime' => app(MetricsRepository::class)->queueWithMaximumRuntime(),
'queueWithMaxThroughput' => app(MetricsRepository::class)->queueWithMaximumThroughput(),
'recentlyFailed' => app(JobRepository::class)->countRecentlyFailed(),
'failedJobs' => app(JobRepository::class)->countRecentlyFailed(),
'recentJobs' => app(JobRepository::class)->countRecent(),
'status' => $this->currentStatus(),
'wait' => collect(app(WaitTimeCalculator::class)->calculate())->take(1),
'periods' => [
'failedJobs' => config('horizon.trim.recent_failed', config('horizon.trim.recent')),
'recentJobs' => config('horizon.trim.recent'),
'recentlyFailed' => config('horizon.trim.failed'),
],
];
}

View File

@@ -2,8 +2,8 @@
namespace Laravel\Horizon\Http\Controllers;
use Laravel\Horizon\Contracts\SupervisorRepository;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\Contracts\SupervisorRepository;
class MasterSupervisorController extends Controller
{

Some files were not shown because too many files have changed in this diff Show More