Inital commit for unit test configuration
This commit is contained in:

committed by
Manish Verma

parent
2f0796e954
commit
e0436b7757
@@ -128,10 +128,8 @@ class SessionGuard implements StatefulGuard, SupportsBasicAuth
|
||||
// First we will try to load the user using the identifier in the session if
|
||||
// one exists. Otherwise we will check for a "remember me" cookie in this
|
||||
// request, and if one exists, attempt to retrieve the user using that.
|
||||
if (! is_null($id)) {
|
||||
if ($this->user = $this->provider->retrieveById($id)) {
|
||||
$this->fireAuthenticatedEvent($this->user);
|
||||
}
|
||||
if (! is_null($id) && $this->user = $this->provider->retrieveById($id)) {
|
||||
$this->fireAuthenticatedEvent($this->user);
|
||||
}
|
||||
|
||||
// If the user is null, but we decrypt a "recaller" cookie we can attempt to
|
||||
@@ -541,7 +539,7 @@ class SessionGuard implements StatefulGuard, SupportsBasicAuth
|
||||
*
|
||||
* @param string $password
|
||||
* @param string $attribute
|
||||
* @return null|bool
|
||||
* @return bool|null
|
||||
*/
|
||||
public function logoutOtherDevices($password, $attribute = 'password')
|
||||
{
|
||||
@@ -549,9 +547,13 @@ class SessionGuard implements StatefulGuard, SupportsBasicAuth
|
||||
return;
|
||||
}
|
||||
|
||||
return tap($this->user()->forceFill([
|
||||
$result = tap($this->user()->forceFill([
|
||||
$attribute => Hash::make($password),
|
||||
]))->save();
|
||||
|
||||
$this->queueRecallerCookie($this->user());
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -172,7 +172,7 @@ class Repository implements CacheContract, ArrayAccess
|
||||
*/
|
||||
public function pull($key, $default = null)
|
||||
{
|
||||
return tap($this->get($key, $default), function ($value) use ($key) {
|
||||
return tap($this->get($key, $default), function () use ($key) {
|
||||
$this->forget($key);
|
||||
});
|
||||
}
|
||||
|
@@ -130,13 +130,8 @@ class Command extends SymfonyCommand
|
||||
// After parsing the signature we will spin through the arguments and options
|
||||
// and set them on this command. These will already be changed into proper
|
||||
// instances of these "InputArgument" and "InputOption" Symfony classes.
|
||||
foreach ($arguments as $argument) {
|
||||
$this->getDefinition()->addArgument($argument);
|
||||
}
|
||||
|
||||
foreach ($options as $option) {
|
||||
$this->getDefinition()->addOption($option);
|
||||
}
|
||||
$this->getDefinition()->addArguments($arguments);
|
||||
$this->getDefinition()->addOptions($options);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -320,7 +315,7 @@ class Command extends SymfonyCommand
|
||||
*
|
||||
* @param string $question
|
||||
* @param string|null $default
|
||||
* @return string
|
||||
* @return mixed
|
||||
*/
|
||||
public function ask($question, $default = null)
|
||||
{
|
||||
@@ -333,7 +328,7 @@ class Command extends SymfonyCommand
|
||||
* @param string $question
|
||||
* @param array $choices
|
||||
* @param string|null $default
|
||||
* @return string
|
||||
* @return mixed
|
||||
*/
|
||||
public function anticipate($question, array $choices, $default = null)
|
||||
{
|
||||
@@ -346,7 +341,7 @@ class Command extends SymfonyCommand
|
||||
* @param string $question
|
||||
* @param array $choices
|
||||
* @param string|null $default
|
||||
* @return string
|
||||
* @return mixed
|
||||
*/
|
||||
public function askWithCompletion($question, array $choices, $default = null)
|
||||
{
|
||||
@@ -362,7 +357,7 @@ class Command extends SymfonyCommand
|
||||
*
|
||||
* @param string $question
|
||||
* @param bool $fallback
|
||||
* @return string
|
||||
* @return mixed
|
||||
*/
|
||||
public function secret($question, $fallback = true)
|
||||
{
|
||||
@@ -422,7 +417,7 @@ class Command extends SymfonyCommand
|
||||
* Write a string as information output.
|
||||
*
|
||||
* @param string $string
|
||||
* @param null|int|string $verbosity
|
||||
* @param int|string|null $verbosity
|
||||
* @return void
|
||||
*/
|
||||
public function info($string, $verbosity = null)
|
||||
@@ -435,7 +430,7 @@ class Command extends SymfonyCommand
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $style
|
||||
* @param null|int|string $verbosity
|
||||
* @param int|string|null $verbosity
|
||||
* @return void
|
||||
*/
|
||||
public function line($string, $style = null, $verbosity = null)
|
||||
@@ -449,7 +444,7 @@ class Command extends SymfonyCommand
|
||||
* Write a string as comment output.
|
||||
*
|
||||
* @param string $string
|
||||
* @param null|int|string $verbosity
|
||||
* @param int|string|null $verbosity
|
||||
* @return void
|
||||
*/
|
||||
public function comment($string, $verbosity = null)
|
||||
@@ -461,7 +456,7 @@ class Command extends SymfonyCommand
|
||||
* Write a string as question output.
|
||||
*
|
||||
* @param string $string
|
||||
* @param null|int|string $verbosity
|
||||
* @param int|string|null $verbosity
|
||||
* @return void
|
||||
*/
|
||||
public function question($string, $verbosity = null)
|
||||
@@ -473,7 +468,7 @@ class Command extends SymfonyCommand
|
||||
* Write a string as error output.
|
||||
*
|
||||
* @param string $string
|
||||
* @param null|int|string $verbosity
|
||||
* @param int|string|null $verbosity
|
||||
* @return void
|
||||
*/
|
||||
public function error($string, $verbosity = null)
|
||||
@@ -485,7 +480,7 @@ class Command extends SymfonyCommand
|
||||
* Write a string as warning output.
|
||||
*
|
||||
* @param string $string
|
||||
* @param null|int|string $verbosity
|
||||
* @param int|string|null $verbosity
|
||||
* @return void
|
||||
*/
|
||||
public function warn($string, $verbosity = null)
|
||||
|
@@ -26,7 +26,7 @@ trait ManagesTransactions
|
||||
// catch any exception we can rollback this transaction so that none of this
|
||||
// gets actually persisted to a database or stored in a permanent fashion.
|
||||
try {
|
||||
return tap($callback($this), function ($result) {
|
||||
return tap($callback($this), function () {
|
||||
$this->commit();
|
||||
});
|
||||
}
|
||||
@@ -166,6 +166,8 @@ trait ManagesTransactions
|
||||
*
|
||||
* @param int|null $toLevel
|
||||
* @return void
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function rollBack($toLevel = null)
|
||||
{
|
||||
@@ -183,7 +185,11 @@ trait ManagesTransactions
|
||||
// Next, we will actually perform this rollback within this database and fire the
|
||||
// rollback event. We will also set the current transaction level to the given
|
||||
// level that was passed into this method so it will be right from here out.
|
||||
$this->performRollBack($toLevel);
|
||||
try {
|
||||
$this->performRollBack($toLevel);
|
||||
} catch (Exception $e) {
|
||||
$this->handleRollBackException($e);
|
||||
}
|
||||
|
||||
$this->transactions = $toLevel;
|
||||
|
||||
@@ -207,6 +213,22 @@ trait ManagesTransactions
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an exception from a rollback.
|
||||
*
|
||||
* @param \Exception $e
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function handleRollBackException($e)
|
||||
{
|
||||
if ($this->causedByLostConnection($e)) {
|
||||
$this->transactions = 0;
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of active transactions.
|
||||
*
|
||||
|
@@ -34,6 +34,7 @@ trait DetectsLostConnections
|
||||
'reset by peer',
|
||||
'Physical connection is not usable',
|
||||
'TCP Provider: Error code 0x68',
|
||||
'Name or service not known',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -152,12 +152,12 @@ class Builder
|
||||
*/
|
||||
public function withoutGlobalScopes(array $scopes = null)
|
||||
{
|
||||
if (is_array($scopes)) {
|
||||
foreach ($scopes as $scope) {
|
||||
$this->withoutGlobalScope($scope);
|
||||
}
|
||||
} else {
|
||||
$this->scopes = [];
|
||||
if (! is_array($scopes)) {
|
||||
$scopes = array_keys($this->scopes);
|
||||
}
|
||||
|
||||
foreach ($scopes as $scope) {
|
||||
$this->withoutGlobalScope($scope);
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -543,7 +543,7 @@ class Builder
|
||||
// and error prone. We don't want constraints because we add eager ones.
|
||||
$relation = Relation::noConstraints(function () use ($name) {
|
||||
try {
|
||||
return $this->getModel()->{$name}();
|
||||
return $this->getModel()->newInstance()->$name();
|
||||
} catch (BadMethodCallException $e) {
|
||||
throw RelationNotFoundException::make($this->getModel(), $name);
|
||||
}
|
||||
|
@@ -361,9 +361,7 @@ class Collection extends BaseCollection implements QueueableCollection
|
||||
*/
|
||||
public function makeHidden($attributes)
|
||||
{
|
||||
return $this->each(function ($model) use ($attributes) {
|
||||
$model->addHidden($attributes);
|
||||
});
|
||||
return $this->each->addHidden($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -374,9 +372,7 @@ class Collection extends BaseCollection implements QueueableCollection
|
||||
*/
|
||||
public function makeVisible($attributes)
|
||||
{
|
||||
return $this->each(function ($model) use ($attributes) {
|
||||
$model->makeVisible($attributes);
|
||||
});
|
||||
return $this->each->makeVisible($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,9 +3,11 @@
|
||||
namespace Illuminate\Database\Eloquent\Concerns;
|
||||
|
||||
use Closure;
|
||||
use RuntimeException;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||
use Illuminate\Database\Query\Builder as QueryBuilder;
|
||||
|
||||
@@ -29,6 +31,10 @@ trait QueriesRelationships
|
||||
|
||||
$relation = $this->getRelationWithoutConstraints($relation);
|
||||
|
||||
if ($relation instanceof MorphTo) {
|
||||
throw new RuntimeException('has() and whereHas() do not support MorphTo relationships.');
|
||||
}
|
||||
|
||||
// If we only need to check for the existence of the relation, then we can optimize
|
||||
// the subquery to only run a "where exists" clause instead of this full "count"
|
||||
// clause. This will make these queries run much faster compared with a count.
|
||||
|
@@ -746,7 +746,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
||||
// If the model has an incrementing key, we can use the "insertGetId" method on
|
||||
// the query builder, which will give us back the final inserted ID for this
|
||||
// table from the database. Not all tables have to be incrementing though.
|
||||
$attributes = $this->attributes;
|
||||
$attributes = $this->getAttributes();
|
||||
|
||||
if ($this->getIncrementing()) {
|
||||
$this->insertAndSetId($query, $attributes);
|
||||
|
@@ -274,7 +274,7 @@ class BelongsTo extends Relation
|
||||
$query->getModel()->setTable($hash);
|
||||
|
||||
return $query->whereColumn(
|
||||
$hash.'.'.$query->getModel()->getKeyName(), '=', $this->getQualifiedForeignKey()
|
||||
$hash.'.'.$this->ownerKey, '=', $this->getQualifiedForeignKey()
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -288,7 +288,7 @@ class BelongsToMany extends Relation
|
||||
* Specify the custom pivot model to use for the relationship.
|
||||
*
|
||||
* @param string $class
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return $this
|
||||
*/
|
||||
public function using($class)
|
||||
{
|
||||
@@ -301,7 +301,7 @@ class BelongsToMany extends Relation
|
||||
* Specify the custom pivot accessor to use for the relationship.
|
||||
*
|
||||
* @param string $accessor
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return $this
|
||||
*/
|
||||
public function as($accessor)
|
||||
{
|
||||
@@ -317,7 +317,7 @@ class BelongsToMany extends Relation
|
||||
* @param string $operator
|
||||
* @param mixed $value
|
||||
* @param string $boolean
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return $this
|
||||
*/
|
||||
public function wherePivot($column, $operator = null, $value = null, $boolean = 'and')
|
||||
{
|
||||
@@ -333,7 +333,7 @@ class BelongsToMany extends Relation
|
||||
* @param mixed $values
|
||||
* @param string $boolean
|
||||
* @param bool $not
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return $this
|
||||
*/
|
||||
public function wherePivotIn($column, $values, $boolean = 'and', $not = false)
|
||||
{
|
||||
@@ -348,7 +348,7 @@ class BelongsToMany extends Relation
|
||||
* @param string $column
|
||||
* @param string $operator
|
||||
* @param mixed $value
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return $this
|
||||
*/
|
||||
public function orWherePivot($column, $operator = null, $value = null)
|
||||
{
|
||||
@@ -362,7 +362,7 @@ class BelongsToMany extends Relation
|
||||
*
|
||||
* @param string $column
|
||||
* @param mixed $value
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return $this
|
||||
*/
|
||||
public function withPivotValue($column, $value = null)
|
||||
{
|
||||
@@ -388,7 +388,7 @@ class BelongsToMany extends Relation
|
||||
*
|
||||
* @param string $column
|
||||
* @param mixed $values
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return $this
|
||||
*/
|
||||
public function orWherePivotIn($column, $values)
|
||||
{
|
||||
@@ -568,10 +568,10 @@ class BelongsToMany extends Relation
|
||||
// First we'll add the proper select columns onto the query so it is run with
|
||||
// the proper columns. Then, we will get the results and hydrate out pivot
|
||||
// models with the result of those columns as a separate model relation.
|
||||
$columns = $this->query->getQuery()->columns ? [] : $columns;
|
||||
|
||||
$builder = $this->query->applyScopes();
|
||||
|
||||
$columns = $builder->getQuery()->columns ? [] : $columns;
|
||||
|
||||
$models = $builder->addSelect(
|
||||
$this->shouldSelect($columns)
|
||||
)->getModels();
|
||||
@@ -592,7 +592,7 @@ class BelongsToMany extends Relation
|
||||
* Get the select columns for the relation query.
|
||||
*
|
||||
* @param array $columns
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return array
|
||||
*/
|
||||
protected function shouldSelect(array $columns = ['*'])
|
||||
{
|
||||
@@ -796,7 +796,7 @@ class BelongsToMany extends Relation
|
||||
{
|
||||
$model->save(['touch' => false]);
|
||||
|
||||
$this->attach($model->getKey(), $pivotAttributes, $touch);
|
||||
$this->attach($model, $pivotAttributes, $touch);
|
||||
|
||||
return $model;
|
||||
}
|
||||
@@ -836,7 +836,7 @@ class BelongsToMany extends Relation
|
||||
// accomplish this which will insert the record and any more attributes.
|
||||
$instance->save(['touch' => false]);
|
||||
|
||||
$this->attach($instance->getKey(), $joining, $touch);
|
||||
$this->attach($instance, $joining, $touch);
|
||||
|
||||
return $instance;
|
||||
}
|
||||
@@ -926,7 +926,7 @@ class BelongsToMany extends Relation
|
||||
*
|
||||
* @param mixed $createdAt
|
||||
* @param mixed $updatedAt
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
* @return $this
|
||||
*/
|
||||
public function withTimestamps($createdAt = null, $updatedAt = null)
|
||||
{
|
||||
|
@@ -474,11 +474,11 @@ trait InteractsWithPivotTable
|
||||
protected function parseIds($value)
|
||||
{
|
||||
if ($value instanceof Model) {
|
||||
return [$value->getKey()];
|
||||
return [$value->{$this->relatedKey}];
|
||||
}
|
||||
|
||||
if ($value instanceof Collection) {
|
||||
return $value->modelKeys();
|
||||
return $value->pluck($this->relatedKey)->all();
|
||||
}
|
||||
|
||||
if ($value instanceof BaseCollection) {
|
||||
@@ -496,7 +496,7 @@ trait InteractsWithPivotTable
|
||||
*/
|
||||
protected function parseId($value)
|
||||
{
|
||||
return $value instanceof Model ? $value->getKey() : $value;
|
||||
return $value instanceof Model ? $value->{$this->relatedKey} : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -461,8 +461,10 @@ class HasManyThrough extends Relation
|
||||
*/
|
||||
protected function prepareQueryBuilder($columns = ['*'])
|
||||
{
|
||||
return $this->query->applyScopes()->addSelect(
|
||||
$this->shouldSelect($this->query->getQuery()->columns ? [] : $columns)
|
||||
$builder = $this->query->applyScopes();
|
||||
|
||||
return $builder->addSelect(
|
||||
$this->shouldSelect($builder->getQuery()->columns ? [] : $columns)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -508,7 +510,7 @@ class HasManyThrough extends Relation
|
||||
$query->getModel()->setTable($hash);
|
||||
|
||||
return $query->select($columns)->whereColumn(
|
||||
$parentQuery->getQuery()->from.'.'.$query->getModel()->getKeyName(), '=', $this->getQualifiedFirstKeyName()
|
||||
$parentQuery->getQuery()->from.'.'.$this->localKey, '=', $this->getQualifiedFirstKeyName()
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -223,6 +223,36 @@ class MorphTo extends BelongsTo
|
||||
return $this->parent->setRelation($this->relation, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Touch all of the related models for the relationship.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function touch()
|
||||
{
|
||||
if (! is_null($this->ownerKey)) {
|
||||
parent::touch();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all or passed registered global scopes.
|
||||
*
|
||||
* @param array|null $scopes
|
||||
* @return $this
|
||||
*/
|
||||
public function withoutGlobalScopes(array $scopes = null)
|
||||
{
|
||||
$this->getQuery()->withoutGlobalScopes($scopes);
|
||||
|
||||
$this->macroBuffer[] = [
|
||||
'method' => __FUNCTION__,
|
||||
'parameters' => [$scopes],
|
||||
];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the foreign key "type" name.
|
||||
*
|
||||
|
@@ -223,7 +223,7 @@ abstract class Relation
|
||||
{
|
||||
return collect($models)->map(function ($value) use ($key) {
|
||||
return $key ? $value->getAttribute($key) : $value->getKey();
|
||||
})->values()->unique()->sort()->all();
|
||||
})->values()->unique(null, true)->sort()->all();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -76,9 +76,7 @@ trait SoftDeletes
|
||||
$columns[$this->getUpdatedAtColumn()] = $this->fromDateTime($time);
|
||||
}
|
||||
|
||||
if ($query->update($columns)) {
|
||||
$this->syncOriginal();
|
||||
}
|
||||
$query->update($columns);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1389,7 +1389,7 @@ class Builder
|
||||
{
|
||||
$type = $not ? 'NotExists' : 'Exists';
|
||||
|
||||
$this->wheres[] = compact('type', 'operator', 'query', 'boolean');
|
||||
$this->wheres[] = compact('type', 'query', 'boolean');
|
||||
|
||||
$this->addBinding($query->getBindings(), 'where');
|
||||
|
||||
|
@@ -490,9 +490,11 @@ class Grammar extends BaseGrammar
|
||||
*/
|
||||
protected function whereRowValues(Builder $query, $where)
|
||||
{
|
||||
$columns = $this->columnize($where['columns']);
|
||||
|
||||
$values = $this->parameterize($where['values']);
|
||||
|
||||
return '('.implode(', ', $where['columns']).') '.$where['operator'].' ('.$values.')';
|
||||
return '('.$columns.') '.$where['operator'].' ('.$values.')';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -930,6 +932,17 @@ class Grammar extends BaseGrammar
|
||||
throw new RuntimeException('This database engine does not support JSON operations.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap the given JSON path.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
protected function wrapJsonPath($value)
|
||||
{
|
||||
return '\'$."'.str_replace('->', '"."', $value).'"\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given string is a JSON selector.
|
||||
*
|
||||
|
@@ -273,4 +273,23 @@ class SQLiteGrammar extends Grammar
|
||||
'delete from '.$this->wrapTable($query->from) => [],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap the given JSON selector.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
protected function wrapJsonSelector($value)
|
||||
{
|
||||
$parts = explode('->', $value, 2);
|
||||
|
||||
$field = $this->wrap($parts[0]);
|
||||
|
||||
$path = count($parts) > 1 ? ', '.$this->wrapJsonPath($parts[1]) : '';
|
||||
|
||||
$selector = 'json_extract('.$field.$path.')';
|
||||
|
||||
return $selector;
|
||||
}
|
||||
}
|
||||
|
@@ -103,6 +103,20 @@ class SqlServerGrammar extends Grammar
|
||||
return 'cast('.$this->wrap($where['column']).' as date) '.$where['operator'].' '.$value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile a "where time" clause.
|
||||
*
|
||||
* @param \Illuminate\Database\Query\Builder $query
|
||||
* @param array $where
|
||||
* @return string
|
||||
*/
|
||||
protected function whereTime(Builder $query, $where)
|
||||
{
|
||||
$value = $this->parameter($where['value']);
|
||||
|
||||
return 'cast('.$this->wrap($where['column']).' as time) '.$where['operator'].' '.$value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile a "JSON contains" statement into SQL.
|
||||
*
|
||||
@@ -458,17 +472,6 @@ class SqlServerGrammar extends Grammar
|
||||
return 'json_value('.$field.', '.$this->wrapJsonPath($parts[0]).')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap the given JSON path.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
protected function wrapJsonPath($value)
|
||||
{
|
||||
return '\'$."'.str_replace('->', '"."', $value).'"\'';
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap a table in keyword identifiers.
|
||||
*
|
||||
|
@@ -1062,7 +1062,7 @@ class Blueprint
|
||||
* Create a new point column on the table.
|
||||
*
|
||||
* @param string $column
|
||||
* @param null|int $srid
|
||||
* @param int|null $srid
|
||||
* @return \Illuminate\Support\Fluent
|
||||
*/
|
||||
public function point($column, $srid = null)
|
||||
|
@@ -69,7 +69,7 @@ class Builder
|
||||
{
|
||||
$table = $this->connection->getTablePrefix().$table;
|
||||
|
||||
return count($this->connection->select(
|
||||
return count($this->connection->selectFromWriteConnection(
|
||||
$this->grammar->compileTableExists(), [$table]
|
||||
)) > 0;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ class Builder
|
||||
*/
|
||||
public function getColumnListing($table)
|
||||
{
|
||||
$results = $this->connection->select($this->grammar->compileColumnListing(
|
||||
$results = $this->connection->selectFromWriteConnection($this->grammar->compileColumnListing(
|
||||
$this->connection->getTablePrefix().$table
|
||||
));
|
||||
|
||||
|
@@ -452,10 +452,8 @@ class Filesystem
|
||||
*/
|
||||
public function moveDirectory($from, $to, $overwrite = false)
|
||||
{
|
||||
if ($overwrite && $this->isDirectory($to)) {
|
||||
if (! $this->deleteDirectory($to)) {
|
||||
return false;
|
||||
}
|
||||
if ($overwrite && $this->isDirectory($to) && ! $this->deleteDirectory($to)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return @rename($from, $to) === true;
|
||||
|
@@ -29,7 +29,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const VERSION = '5.6.33';
|
||||
const VERSION = '5.6.38';
|
||||
|
||||
/**
|
||||
* The base path for the Laravel installation.
|
||||
|
@@ -84,6 +84,10 @@ class ModelMakeCommand extends GeneratorCommand
|
||||
{
|
||||
$table = Str::plural(Str::snake(class_basename($this->argument('name'))));
|
||||
|
||||
if ($this->option('pivot')) {
|
||||
$table = Str::singular($table);
|
||||
}
|
||||
|
||||
$this->call('make:migration', [
|
||||
'name' => "create_{$table}_table",
|
||||
'--create' => $table,
|
||||
|
@@ -1,8 +1,20 @@
|
||||
|
||||
// Body
|
||||
$body-bg: #f5f8fa;
|
||||
$body-bg: #f8fafc;
|
||||
|
||||
// Typography
|
||||
$font-family-sans-serif: "Raleway", sans-serif;
|
||||
$font-family-sans-serif: "Nunito", sans-serif;
|
||||
$font-size-base: 0.9rem;
|
||||
$line-height-base: 1.6;
|
||||
|
||||
// Colors
|
||||
$blue: #3490dc;
|
||||
$indigo: #6574cd;
|
||||
$purple: #9561e2;
|
||||
$pink: #f66D9b;
|
||||
$red: #e3342f;
|
||||
$orange: #f6993f;
|
||||
$yellow: #ffed4a;
|
||||
$green: #38c172;
|
||||
$teal: #4dc0b5;
|
||||
$cyan: #6cb2eb;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
|
||||
// Fonts
|
||||
@import url("https://fonts.googleapis.com/css?family=Raleway:300,400,600");
|
||||
@import url('https://fonts.googleapis.com/css?family=Nunito');
|
||||
|
||||
// Variables
|
||||
@import "variables";
|
||||
@import 'variables';
|
||||
|
||||
// Bootstrap
|
||||
@import '~bootstrap/scss/bootstrap';
|
||||
|
@@ -8,14 +8,14 @@
|
||||
<title>@yield('title')</title>
|
||||
|
||||
<!-- Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css">
|
||||
|
||||
<!-- Styles -->
|
||||
<style>
|
||||
html, body {
|
||||
background-color: #fff;
|
||||
color: #636b6f;
|
||||
font-family: 'Raleway', sans-serif;
|
||||
font-family: 'Nunito', sans-serif;
|
||||
font-weight: 100;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
|
@@ -110,7 +110,9 @@ class JsonResource implements ArrayAccess, JsonSerializable, Responsable, UrlRou
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return $this->resource->toArray();
|
||||
return is_array($this->resource)
|
||||
? $this->resource
|
||||
: $this->resource->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -157,7 +157,7 @@ class Mailable implements MailableContract, Renderable
|
||||
*/
|
||||
public function queue(Queue $queue)
|
||||
{
|
||||
if (property_exists($this, 'delay')) {
|
||||
if (isset($this->delay)) {
|
||||
return $this->later($this->delay, $queue);
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,7 @@
|
||||
{{-- Footer --}}
|
||||
@slot('footer')
|
||||
@component('mail::footer')
|
||||
© {{ date('Y') }} {{ config('app.name') }}. All rights reserved.
|
||||
© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.')
|
||||
@endcomponent
|
||||
@endslot
|
||||
@endcomponent
|
||||
|
@@ -21,7 +21,7 @@
|
||||
{{-- Footer --}}
|
||||
@slot('footer')
|
||||
@component('mail::footer')
|
||||
© {{ date('Y') }} {{ config('app.name') }}. All rights reserved.
|
||||
© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.')
|
||||
@endcomponent
|
||||
@endslot
|
||||
@endcomponent
|
||||
|
@@ -33,7 +33,7 @@ class SlackWebhookChannel
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param \Illuminate\Notifications\Notification $notification
|
||||
* @return \Psr\Http\Message\ResponseInterface
|
||||
* @return void
|
||||
*/
|
||||
public function send($notifiable, Notification $notification)
|
||||
{
|
||||
|
@@ -222,7 +222,7 @@ class Listener
|
||||
*/
|
||||
public function memoryExceeded($memoryLimit)
|
||||
{
|
||||
return (memory_get_usage() / 1024 / 1024) >= $memoryLimit;
|
||||
return (memory_get_usage(true) / 1024 / 1024) >= $memoryLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -251,10 +251,14 @@ class Worker
|
||||
$this->exceptions->report($e);
|
||||
|
||||
$this->stopWorkerIfLostConnection($e);
|
||||
|
||||
$this->sleep(1);
|
||||
} catch (Throwable $e) {
|
||||
$this->exceptions->report($e = new FatalThrowableError($e));
|
||||
|
||||
$this->stopWorkerIfLostConnection($e);
|
||||
|
||||
$this->sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,7 +545,7 @@ class Worker
|
||||
*/
|
||||
public function memoryExceeded($memoryLimit)
|
||||
{
|
||||
return (memory_get_usage() / 1024 / 1024) >= $memoryLimit;
|
||||
return (memory_get_usage(true) / 1024 / 1024) >= $memoryLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -21,6 +21,7 @@ use InvalidArgumentException;
|
||||
* @method \Illuminate\Routing\RouteRegistrar name(string $value)
|
||||
* @method \Illuminate\Routing\RouteRegistrar namespace(string $value)
|
||||
* @method \Illuminate\Routing\RouteRegistrar prefix(string $prefix)
|
||||
* @method \Illuminate\Routing\RouteRegistrar where(array $where)
|
||||
*/
|
||||
class RouteRegistrar
|
||||
{
|
||||
@@ -53,7 +54,7 @@ class RouteRegistrar
|
||||
* @var array
|
||||
*/
|
||||
protected $allowedAttributes = [
|
||||
'as', 'domain', 'middleware', 'name', 'namespace', 'prefix',
|
||||
'as', 'domain', 'middleware', 'name', 'namespace', 'prefix', 'where',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@@ -12,6 +12,7 @@ namespace Illuminate\Support\Facades;
|
||||
* @method static \Illuminate\Routing\Route any(string $uri, \Closure|array|string|null $action = null)
|
||||
* @method static \Illuminate\Routing\Route match(array|string $methods, string $uri, \Closure|array|string|null $action = null)
|
||||
* @method static \Illuminate\Routing\RouteRegistrar prefix(string $prefix)
|
||||
* @method static \Illuminate\Routing\RouteRegistrar where(array $where)
|
||||
* @method static \Illuminate\Routing\PendingResourceRegistration resource(string $name, string $controller, array $options = [])
|
||||
* @method static \Illuminate\Routing\PendingResourceRegistration apiResource(string $name, string $controller, array $options = [])
|
||||
* @method static void apiResources(array $resources)
|
||||
|
@@ -135,7 +135,7 @@ class EventFake implements Dispatcher
|
||||
*/
|
||||
public function listen($events, $listener)
|
||||
{
|
||||
//
|
||||
$this->dispatcher->listen($events, $listener);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +146,7 @@ class EventFake implements Dispatcher
|
||||
*/
|
||||
public function hasListeners($eventName)
|
||||
{
|
||||
//
|
||||
return $this->dispatcher->hasListeners($eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,7 +169,7 @@ class EventFake implements Dispatcher
|
||||
*/
|
||||
public function subscribe($subscriber)
|
||||
{
|
||||
//
|
||||
$this->dispatcher->subscribe($subscriber);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1528,7 +1528,7 @@ trait ValidatesAttributes
|
||||
((aaa|aaas|about|acap|acct|acr|adiumxtra|afp|afs|aim|apt|attachment|aw|barion|beshare|bitcoin|blob|bolo|callto|cap|chrome|chrome-extension|cid|coap|coaps|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-playcontainer|dlna-playsingle|dns|dntp|dtn|dvb|ed2k|example|facetime|fax|feed|feedready|file|filesystem|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|ham|hcp|http|https|iax|icap|icon|im|imap|info|iotdisco|ipn|ipp|ipps|irc|irc6|ircs|iris|iris.beep|iris.lwz|iris.xpc|iris.xpcs|itms|jabber|jar|jms|keyparc|lastfm|ldap|ldaps|magnet|mailserver|mailto|maps|market|message|mid|mms|modem|ms-help|ms-settings|ms-settings-airplanemode|ms-settings-bluetooth|ms-settings-camera|ms-settings-cellular|ms-settings-cloudstorage|ms-settings-emailandaccounts|ms-settings-language|ms-settings-location|ms-settings-lock|ms-settings-nfctransactions|ms-settings-notifications|ms-settings-power|ms-settings-privacy|ms-settings-proximity|ms-settings-screenrotation|ms-settings-wifi|ms-settings-workplace|msnim|msrp|msrps|mtqp|mumble|mupdate|mvn|news|nfs|ni|nih|nntp|notes|oid|opaquelocktoken|pack|palm|paparazzi|pkcs11|platform|pop|pres|prospero|proxy|psyc|query|redis|rediss|reload|res|resource|rmi|rsync|rtmfp|rtmp|rtsp|rtsps|rtspu|secondlife|s3|service|session|sftp|sgn|shttp|sieve|sip|sips|skype|smb|sms|smtp|snews|snmp|soap.beep|soap.beeps|soldat|spotify|ssh|steam|stun|stuns|submit|svn|tag|teamspeak|tel|teliaeid|telnet|tftp|things|thismessage|tip|tn3270|turn|turns|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|videotex|view-source|wais|webcal|ws|wss|wtai|wyciwyg|xcon|xcon-userid|xfire|xmlrpc\.beep|xmlrpc.beeps|xmpp|xri|ymsgr|z39\.50|z39\.50r|z39\.50s)):// # protocol
|
||||
(([\pL\pN-]+:)?([\pL\pN-]+)@)? # basic auth
|
||||
(
|
||||
([\pL\pN\pS-\.])+(\.?([\pL]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
|
||||
([\pL\pN\pS\-\.])+(\.?([\pL]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
|
||||
| # or
|
||||
\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} # an IP address
|
||||
| # or
|
||||
|
@@ -21,7 +21,7 @@ trait DatabaseRule
|
||||
protected $column;
|
||||
|
||||
/**
|
||||
* There extra where clauses for the query.
|
||||
* The extra where clauses for the query.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
38
vendor/laravel/framework/src/Illuminate/Validation/Rules/RequiredIf.php
vendored
Normal file
38
vendor/laravel/framework/src/Illuminate/Validation/Rules/RequiredIf.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Validation\Rules;
|
||||
|
||||
class RequiredIf
|
||||
{
|
||||
/**
|
||||
* The condition that validates the attribute.
|
||||
*
|
||||
* @var callable|bool
|
||||
*/
|
||||
public $condition;
|
||||
|
||||
/**
|
||||
* Create a new required validation rule based on a condition.
|
||||
*
|
||||
* @param callable|bool $condition
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($condition)
|
||||
{
|
||||
$this->condition = $condition;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the rule to a validation string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (is_callable($this->condition)) {
|
||||
return call_user_func($this->condition) ? 'required' : '';
|
||||
}
|
||||
|
||||
return $this->condition ? 'required' : '';
|
||||
}
|
||||
}
|
@@ -18,7 +18,7 @@ trait CompilesTranslations
|
||||
return "<?php \$__env->startTranslation{$expression}; ?>";
|
||||
}
|
||||
|
||||
return "<?php echo app('translator')->getFromJson{$expression}; ?>";
|
||||
return "<?php echo e(app('translator')->getFromJson{$expression}); ?>";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,7 +28,7 @@ trait CompilesTranslations
|
||||
*/
|
||||
protected function compileEndlang()
|
||||
{
|
||||
return '<?php echo $__env->renderTranslation(); ?>';
|
||||
return '<?php echo e($__env->renderTranslation()); ?>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,6 +39,6 @@ trait CompilesTranslations
|
||||
*/
|
||||
protected function compileChoice($expression)
|
||||
{
|
||||
return "<?php echo app('translator')->choice{$expression}; ?>";
|
||||
return "<?php echo e(app('translator')->choice{$expression}); ?>";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user