removal of unnecessary file, and composer update

This commit is contained in:
2019-01-09 23:31:31 -06:00
parent a90688deb6
commit e4380f2ffe
604 changed files with 32070 additions and 26824 deletions

View File

@@ -85,7 +85,7 @@
"moontoast/math": "^1.1",
"orchestra/testbench-core": "3.7.*",
"pda/pheanstalk": "^3.0",
"phpunit/phpunit": "^7.0",
"phpunit/phpunit": "^7.5",
"predis/predis": "^1.1.1",
"symfony/css-selector": "^4.1",
"symfony/dom-crawler": "^4.1",

View File

@@ -223,13 +223,31 @@ class Command extends SymfonyCommand
*/
protected function createInputFromArguments(array $arguments)
{
return tap(new ArrayInput($arguments), function ($input) {
return tap(new ArrayInput(array_merge($this->context(), $arguments)), function ($input) {
if ($input->hasParameterOption(['--no-interaction'], true)) {
$input->setInteractive(false);
}
});
}
/**
* Get all of the context passed to the command.
*
* @return array
*/
protected function context()
{
return collect($this->option())->only([
'ansi',
'no-ansi',
'no-interaction',
'quiet',
'verbose',
])->filter()->mapWithKeys(function ($value, $key) {
return ["--{$key}" => $value];
})->all();
}
/**
* Determine if the given argument is present.
*
@@ -551,6 +569,16 @@ class Command extends SymfonyCommand
return $this->hidden;
}
/**
* {@inheritdoc}
*/
public function setHidden($hidden)
{
parent::setHidden($this->hidden = $hidden);
return $this;
}
/**
* Get the console command arguments.
*

View File

@@ -47,13 +47,13 @@ class FreshCommand extends Command
$this->info('Dropped all tables successfully.');
$this->call('migrate', [
$this->call('migrate', array_filter([
'--database' => $database,
'--path' => $this->input->getOption('path'),
'--realpath' => $this->input->getOption('realpath'),
'--force' => true,
'--step' => $this->option('step'),
]);
]));
if ($this->needsSeeding()) {
$this->runSeeder($database);
@@ -104,11 +104,11 @@ class FreshCommand extends Command
*/
protected function runSeeder($database)
{
$this->call('db:seed', [
$this->call('db:seed', array_filter([
'--database' => $database,
'--class' => $this->option('seeder') ?: 'DatabaseSeeder',
'--force' => $this->option('force'),
]);
'--force' => true,
]));
}
/**

View File

@@ -74,7 +74,7 @@ class MigrateCommand extends BaseCommand
// Finally, if the "seed" option has been given, we will re-run the database
// seed task to re-populate the database, which is convenient when adding
// a migration and a seed at the same time, as it is only this command.
if ($this->option('seed')) {
if ($this->option('seed') && ! $this->option('pretend')) {
$this->call('db:seed', ['--force' => true]);
}
}
@@ -89,9 +89,9 @@ class MigrateCommand extends BaseCommand
$this->migrator->setConnection($this->option('database'));
if (! $this->migrator->repositoryExists()) {
$this->call(
'migrate:install', ['--database' => $this->option('database')]
);
$this->call('migrate:install', array_filter([
'--database' => $this->option('database'),
]));
}
}
}

View File

@@ -42,28 +42,26 @@ class RefreshCommand extends Command
$path = $this->input->getOption('path');
$force = $this->input->getOption('force');
// If the "step" option is specified it means we only want to rollback a small
// number of migrations before migrating again. For example, the user might
// only rollback and remigrate the latest four migrations instead of all.
$step = $this->input->getOption('step') ?: 0;
if ($step > 0) {
$this->runRollback($database, $path, $step, $force);
$this->runRollback($database, $path, $step);
} else {
$this->runReset($database, $path, $force);
$this->runReset($database, $path);
}
// The refresh command is essentially just a brief aggregate of a few other of
// the migration commands and just provides a convenient wrapper to execute
// them in succession. We'll also see if we need to re-seed the database.
$this->call('migrate', [
$this->call('migrate', array_filter([
'--database' => $database,
'--path' => $path,
'--realpath' => $this->input->getOption('realpath'),
'--force' => $force,
]);
'--force' => true,
]));
if ($this->needsSeeding()) {
$this->runSeeder($database);
@@ -75,19 +73,18 @@ class RefreshCommand extends Command
*
* @param string $database
* @param string $path
* @param bool $step
* @param bool $force
* @param int $step
* @return void
*/
protected function runRollback($database, $path, $step, $force)
protected function runRollback($database, $path, $step)
{
$this->call('migrate:rollback', [
$this->call('migrate:rollback', array_filter([
'--database' => $database,
'--path' => $path,
'--realpath' => $this->input->getOption('realpath'),
'--step' => $step,
'--force' => $force,
]);
'--force' => true,
]));
}
/**
@@ -95,17 +92,16 @@ class RefreshCommand extends Command
*
* @param string $database
* @param string $path
* @param bool $force
* @return void
*/
protected function runReset($database, $path, $force)
protected function runReset($database, $path)
{
$this->call('migrate:reset', [
$this->call('migrate:reset', array_filter([
'--database' => $database,
'--path' => $path,
'--realpath' => $this->input->getOption('realpath'),
'--force' => $force,
]);
'--force' => true,
]));
}
/**
@@ -126,11 +122,11 @@ class RefreshCommand extends Command
*/
protected function runSeeder($database)
{
$this->call('db:seed', [
$this->call('db:seed', array_filter([
'--database' => $database,
'--class' => $this->option('seeder') ?: 'DatabaseSeeder',
'--force' => $this->option('force'),
]);
'--force' => true,
]));
}
/**

View File

@@ -34,9 +34,10 @@ trait DetectsLostConnections
'reset by peer',
'Physical connection is not usable',
'TCP Provider: Error code 0x68',
'Name or service not known',
'php_network_getaddresses: getaddrinfo failed: Name or service not known',
'ORA-03114',
'Packets out of order. Expected',
'Adaptive Server connection failed',
]);
}
}

View File

@@ -118,10 +118,14 @@ class Collection extends BaseCollection implements QueueableCollection
$segments[count($segments) - 1] .= ':'.explode(':', $key)[1];
}
$path = array_combine($segments, $segments);
$path = [];
foreach ($segments as $segment) {
$path[] = [$segment => $segment];
}
if (is_callable($value)) {
$path[end($segments)] = $value;
$path[count($segments) - 1][end($segments)] = $value;
}
$this->loadMissingRelation($this, $path);
@@ -139,7 +143,7 @@ class Collection extends BaseCollection implements QueueableCollection
*/
protected function loadMissingRelation(Collection $models, array $path)
{
$relation = array_splice($path, 0, 1);
$relation = array_shift($path);
$name = explode(':', key($relation))[0];
@@ -178,12 +182,8 @@ class Collection extends BaseCollection implements QueueableCollection
->groupBy(function ($model) {
return get_class($model);
})
->filter(function ($models, $className) use ($relations) {
return Arr::has($relations, $className);
})
->each(function ($models, $className) use ($relations) {
$className::with($relations[$className])
->eagerLoadRelations($models->all());
static::make($models)->load($relations[$className] ?? []);
});
return $this;

View File

@@ -1043,7 +1043,7 @@ trait HasAttributes
}
/**
* Determine if the model or given attribute(s) have been modified.
* Determine if the model or any of the given attribute(s) have been modified.
*
* @param array|string|null $attributes
* @return bool
@@ -1056,7 +1056,7 @@ trait HasAttributes
}
/**
* Determine if the model or given attribute(s) have remained the same.
* Determine if the model and all the given attribute(s) have remained the same.
*
* @param array|string|null $attributes
* @return bool
@@ -1067,7 +1067,7 @@ trait HasAttributes
}
/**
* Determine if the model or given attribute(s) have been modified.
* Determine if the model or any of the given attribute(s) have been modified.
*
* @param array|string|null $attributes
* @return bool
@@ -1080,7 +1080,7 @@ trait HasAttributes
}
/**
* Determine if the given attributes were changed.
* Determine if any of the given attributes were changed.
*
* @param array $changes
* @param array|string|null $attributes

View File

@@ -75,6 +75,10 @@ class BelongsTo extends Relation
*/
public function getResults()
{
if (is_null($this->child->{$this->foreignKey})) {
return $this->getDefaultFor($this->parent);
}
return $this->query->first() ?: $this->getDefaultFor($this->parent);
}
@@ -132,13 +136,6 @@ class BelongsTo extends Relation
}
}
// If there are no keys that were not null we will just return an array with null
// so this query wont fail plus returns zero results, which should be what the
// developer expects to happen in this situation. Otherwise we'll sort them.
if (count($keys) === 0) {
return [null];
}
sort($keys);
return array_values(array_unique($keys));

View File

@@ -559,7 +559,9 @@ class BelongsToMany extends Relation
*/
public function getResults()
{
return $this->get();
return ! is_null($this->parent->{$this->parentKey})
? $this->get()
: $this->related->newCollection();
}
/**
@@ -678,6 +680,32 @@ class BelongsToMany extends Relation
});
}
/**
* Chunk the results of a query by comparing numeric IDs.
*
* @param int $count
* @param callable $callback
* @param string|null $column
* @param string|null $alias
* @return bool
*/
public function chunkById($count, callable $callback, $column = null, $alias = null)
{
$this->query->addSelect($this->shouldSelect());
$column = $column ?? $this->getRelated()->qualifyColumn(
$this->getRelatedKeyName()
);
$alias = $alias ?? $this->getRelatedKeyName();
return $this->query->chunkById($count, function ($results) use ($callback) {
$this->hydratePivotRelation($results->all());
return $callback($results);
}, $column, $alias);
}
/**
* Execute a callback over each item while chunking.
*

View File

@@ -13,7 +13,9 @@ class HasMany extends HasOneOrMany
*/
public function getResults()
{
return $this->query->get();
return ! is_null($this->getParentKey())
? $this->query->get()
: $this->related->newCollection();
}
/**

View File

@@ -343,7 +343,9 @@ class HasManyThrough extends Relation
*/
public function getResults()
{
return $this->get();
return ! is_null($this->farParent->{$this->localKey})
? $this->get()
: $this->related->newCollection();
}
/**
@@ -427,6 +429,24 @@ class HasManyThrough extends Relation
return $this->prepareQueryBuilder()->chunk($count, $callback);
}
/**
* Chunk the results of a query by comparing numeric IDs.
*
* @param int $count
* @param callable $callback
* @param string|null $column
* @param string|null $alias
* @return bool
*/
public function chunkById($count, callable $callback, $column = null, $alias = null)
{
$column = $column ?? $this->getRelated()->getQualifiedKeyName();
$alias = $alias ?? $this->getRelated()->getKeyName();
return $this->prepareQueryBuilder()->chunkById($count, $callback, $column, $alias);
}
/**
* Get a generator for the given query.
*

View File

@@ -17,6 +17,10 @@ class HasOne extends HasOneOrMany
*/
public function getResults()
{
if (is_null($this->getParentKey())) {
return $this->getDefaultFor($this->parent);
}
return $this->query->first() ?: $this->getDefaultFor($this->parent);
}

View File

@@ -310,21 +310,6 @@ abstract class HasOneOrMany extends Relation
$model->setAttribute($this->getForeignKeyName(), $this->getParentKey());
}
/**
* Perform an update on all the related models.
*
* @param array $attributes
* @return int
*/
public function update(array $attributes)
{
if ($this->related->usesTimestamps() && ! is_null($this->relatedUpdatedAt())) {
$attributes[$this->relatedUpdatedAt()] = $this->related->freshTimestampString();
}
return $this->query->update($attributes);
}
/**
* Add the constraints for a relationship query.
*

View File

@@ -13,7 +13,9 @@ class MorphMany extends MorphOneOrMany
*/
public function getResults()
{
return $this->query->get();
return ! is_null($this->getParentKey())
? $this->query->get()
: $this->related->newCollection();
}
/**

View File

@@ -17,6 +17,10 @@ class MorphOne extends MorphOneOrMany
*/
public function getResults()
{
if (is_null($this->getParentKey())) {
return $this->getDefaultFor($this->parent);
}
return $this->query->first() ?: $this->getDefaultFor($this->parent);
}

View File

@@ -81,16 +81,6 @@ class MorphTo extends BelongsTo
}
}
/**
* Get the results of the relationship.
*
* @return mixed
*/
public function getResults()
{
return $this->ownerKey ? parent::getResults() : null;
}
/**
* Get the results of the relationship.
*
@@ -227,7 +217,7 @@ class MorphTo extends BelongsTo
*/
public function touch()
{
if (! is_null($this->ownerKey)) {
if (! is_null($this->child->{$this->foreignKey})) {
parent::touch();
}
}

View File

@@ -382,7 +382,7 @@ class Builder
*/
public function join($table, $first, $operator = null, $second = null, $type = 'inner', $where = false)
{
$join = new JoinClause($this, $type, $table);
$join = $this->newJoinClause($this, $type, $table);
// If the first "column" of the join is really a Closure instance the developer
// is trying to build a join with a complex "on" clause containing more than
@@ -550,11 +550,24 @@ class Builder
return $this->join($table, $first, $operator, $second, 'cross');
}
$this->joins[] = new JoinClause($this, 'cross', $table);
$this->joins[] = $this->newJoinClause($this, 'cross', $table);
return $this;
}
/**
* Get a new join clause.
*
* @param \Illuminate\Database\Query\Builder $parentQuery
* @param string $type
* @param string $table
* @return \Illuminate\Database\Query\JoinClause
*/
protected function newJoinClause(self $parentQuery, $type, $table)
{
return new JoinClause($parentQuery, $type, $table);
}
/**
* Merge an array of where clauses and bindings.
*

View File

@@ -4,6 +4,7 @@ namespace Illuminate\Filesystem;
use RuntimeException;
use Illuminate\Http\File;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use InvalidArgumentException;
use Illuminate\Support\Carbon;
@@ -50,27 +51,39 @@ class FilesystemAdapter implements FilesystemContract, CloudFilesystemContract
/**
* Assert that the given file exists.
*
* @param string $path
* @return void
* @param string|array $path
* @return $this
*/
public function assertExists($path)
{
PHPUnit::assertTrue(
$this->exists($path), "Unable to find a file at path [{$path}]."
);
$paths = Arr::wrap($path);
foreach ($paths as $path) {
PHPUnit::assertTrue(
$this->exists($path), "Unable to find a file at path [{$path}]."
);
}
return $this;
}
/**
* Assert that the given file does not exist.
*
* @param string $path
* @return void
* @param string|array $path
* @return $this
*/
public function assertMissing($path)
{
PHPUnit::assertFalse(
$this->exists($path), "Found unexpected file at path [{$path}]."
);
$paths = Arr::wrap($path);
foreach ($paths as $path) {
PHPUnit::assertFalse(
$this->exists($path), "Found unexpected file at path [{$path}]."
);
}
return $this;
}
/**

View File

@@ -29,7 +29,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*
* @var string
*/
const VERSION = '5.7.19';
const VERSION = '5.7.20';
/**
* The base path for the Laravel installation.

View File

@@ -36,6 +36,10 @@ trait VerifiesEmails
throw new AuthorizationException;
}
if ($request->user()->hasVerifiedEmail()) {
return redirect($this->redirectPath());
}
if ($request->user()->markEmailAsVerified()) {
event(new Verified($request->user()));
}

View File

@@ -4,8 +4,8 @@
@section('title', __('Unauthorized'))
@section('image')
<div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
<div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
@section('message', __('Sorry, you are not authorized to access this page.'))

View File

@@ -4,8 +4,8 @@
@section('title', __('Forbidden'))
@section('image')
<div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
<div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
@section('message', __($exception->getMessage() ?: __('Sorry, you are forbidden from accessing this page.')))

View File

@@ -4,8 +4,8 @@
@section('title', __('Page Not Found'))
@section('image')
<div style="background-image: url({{ asset('/svg/404.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
<div style="background-image: url({{ asset('/svg/404.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
@section('message', __('Sorry, the page you are looking for could not be found.'))

View File

@@ -4,8 +4,8 @@
@section('title', __('Page Expired'))
@section('image')
<div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
<div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
@section('message', __('Sorry, your session has expired. Please refresh and try again.'))

View File

@@ -4,8 +4,8 @@
@section('title', __('Too Many Requests'))
@section('image')
<div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
<div style="background-image: url({{ asset('/svg/403.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
@section('message', __('Sorry, you are making too many requests to our servers.'))

View File

@@ -4,8 +4,8 @@
@section('title', __('Error'))
@section('image')
<div style="background-image: url({{ asset('/svg/500.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
<div style="background-image: url({{ asset('/svg/500.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
@section('message', __('Whoops, something went wrong on our servers.'))

View File

@@ -4,8 +4,8 @@
@section('title', __('Service Unavailable'))
@section('image')
<div style="background-image: url({{ asset('/svg/503.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
<div style="background-image: url({{ asset('/svg/503.svg') }});" class="absolute pin bg-cover bg-no-repeat md:bg-left lg:bg-center">
</div>
@endsection
@section('message', __($exception->getMessage() ?: __('Sorry, we are doing some maintenance. Please check back soon.')))

View File

@@ -243,6 +243,17 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
return $this->headers->get('X-PJAX') == true;
}
/**
* Determine if the request is the result of an prefetch call.
*
* @return bool
*/
public function prefetch()
{
return strcasecmp($this->server->get('HTTP_X_MOZ'), 'prefetch') === 0 ||
strcasecmp($this->headers->get('Purpose'), 'prefetch') === 0;
}
/**
* Determine if the request is over HTTPS.
*

View File

@@ -2,6 +2,7 @@
namespace Illuminate\Http\Resources;
use JsonSerializable;
use Illuminate\Support\Collection;
class MergeValue
@@ -21,6 +22,12 @@ class MergeValue
*/
public function __construct($data)
{
$this->data = $data instanceof Collection ? $data->all() : $data;
if ($data instanceof Collection) {
$this->data = $data->all();
} elseif ($data instanceof JsonSerializable) {
$this->data = $data->jsonSerialize();
} else {
$this->data = $data;
}
}
}

View File

@@ -232,7 +232,7 @@ class LogManager implements LoggerInterface
new StreamHandler(
$config['path'], $this->level($config),
$config['bubble'] ?? true, $config['permission'] ?? null, $config['locking'] ?? false
)
), $config
),
]);
}
@@ -249,7 +249,7 @@ class LogManager implements LoggerInterface
$this->prepareHandler(new RotatingFileHandler(
$config['path'], $config['days'] ?? 7, $this->level($config),
$config['bubble'] ?? true, $config['permission'] ?? null, $config['locking'] ?? false
)),
), $config),
]);
}
@@ -288,7 +288,7 @@ class LogManager implements LoggerInterface
return new Monolog($this->parseChannel($config), [
$this->prepareHandler(new SyslogHandler(
$this->app['config']['app.name'], $config['facility'] ?? LOG_USER, $this->level($config)
)),
), $config),
]);
}

View File

@@ -84,6 +84,13 @@ class Route
*/
public $parameterNames;
/**
* The array of the matched parameters' original values.
*
* @var array
*/
protected $originalParameters;
/**
* The computed gathered middleware.
*
@@ -300,6 +307,8 @@ class Route
$this->parameters = (new RouteParameterBinder($this))
->parameters($request);
$this->originalParameters = $this->parameters;
return $this;
}
@@ -340,6 +349,18 @@ class Route
return Arr::get($this->parameters(), $name, $default);
}
/**
* Get original value of a given parameter from the route.
*
* @param string $name
* @param mixed $default
* @return string
*/
public function originalParameter($name, $default = null)
{
return Arr::get($this->originalParameters(), $name, $default);
}
/**
* Set a parameter to the given value.
*
@@ -383,6 +404,22 @@ class Route
throw new LogicException('Route is not bound.');
}
/**
* Get the key / value list of original parameters for the route.
*
* @return array
*
* @throws \LogicException
*/
public function originalParameters()
{
if (isset($this->originalParameters)) {
return $this->originalParameters;
}
throw new LogicException('Route is not bound.');
}
/**
* Get the key / value list of parameters without null values.
*

View File

@@ -362,7 +362,7 @@ class UrlGenerator implements UrlGeneratorContract
Arr::except($request->query(), 'signature')
), '?');
$expires = Arr::get($request->query(), 'expires');
$expires = $request->query('expires');
$signature = hash_hmac('sha256', $original, call_user_func($this->keyResolver));

View File

@@ -154,7 +154,10 @@ class StartSession
*/
protected function storeCurrentUrl(Request $request, $session)
{
if ($request->method() === 'GET' && $request->route() && ! $request->ajax()) {
if ($request->method() === 'GET' &&
$request->route() &&
! $request->ajax() &&
! $request->prefetch()) {
$session->setPreviousUrl($request->fullUrl());
}
}

View File

@@ -679,7 +679,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate
}
/**
* Filter items where the given key between values.
* Filter items such that the value of the given key is between the given values.
*
* @param string $key
* @param array $values
@@ -690,6 +690,20 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate
return $this->where($key, '>=', reset($values))->where($key, '<=', end($values));
}
/**
* Filter items such that the value of the given key is not between the given values.
*
* @param string $key
* @param array $values
* @return static
*/
public function whereNotBetween($key, $values)
{
return $this->filter(function ($item) use ($key, $values) {
return data_get($item, $key) < reset($values) || data_get($item, $key) > end($values);
});
}
/**
* Filter items by the given key value pair.
*

View File

@@ -428,7 +428,7 @@ class Str
$title = str_replace('@', $separator.'at'.$separator, $title);
// Remove all characters that are not the separator, letters, numbers, or whitespace.
$title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($title));
$title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', static::lower($title));
// Replace all separator characters and whitespace by a single separator
$title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title);

View File

@@ -327,6 +327,16 @@ class QueueFake extends QueueManager implements Queue
}
}
/**
* Get the jobs that have been pushed.
*
* @return array
*/
public function pushedJobs()
{
return $this->jobs;
}
/**
* Get the connection name for the queue.
*