Unverified Commit b379bd39 authored by Divine's avatar Divine Committed by GitHub

Merge pull request #1986 from divine/analysis-KZ0ZE3

[4.x] Apply fixes from StyleCI
parents 444e90df 56b874de
...@@ -11,7 +11,7 @@ use MongoDB\BSON\UTCDateTime; ...@@ -11,7 +11,7 @@ use MongoDB\BSON\UTCDateTime;
class DatabaseTokenRepository extends BaseDatabaseTokenRepository class DatabaseTokenRepository extends BaseDatabaseTokenRepository
{ {
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function getPayload($email, $token) protected function getPayload($email, $token)
{ {
...@@ -23,7 +23,7 @@ class DatabaseTokenRepository extends BaseDatabaseTokenRepository ...@@ -23,7 +23,7 @@ class DatabaseTokenRepository extends BaseDatabaseTokenRepository
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function tokenExpired($createdAt) protected function tokenExpired($createdAt)
{ {
...@@ -33,7 +33,7 @@ class DatabaseTokenRepository extends BaseDatabaseTokenRepository ...@@ -33,7 +33,7 @@ class DatabaseTokenRepository extends BaseDatabaseTokenRepository
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function tokenRecentlyCreated($createdAt) protected function tokenRecentlyCreated($createdAt)
{ {
......
...@@ -7,7 +7,7 @@ use Illuminate\Auth\Passwords\PasswordBrokerManager as BasePasswordBrokerManager ...@@ -7,7 +7,7 @@ use Illuminate\Auth\Passwords\PasswordBrokerManager as BasePasswordBrokerManager
class PasswordBrokerManager extends BasePasswordBrokerManager class PasswordBrokerManager extends BasePasswordBrokerManager
{ {
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function createTokenRepository(array $config) protected function createTokenRepository(array $config)
{ {
......
...@@ -29,7 +29,7 @@ class PasswordResetServiceProvider extends BasePasswordResetServiceProvider ...@@ -29,7 +29,7 @@ class PasswordResetServiceProvider extends BasePasswordResetServiceProvider
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function registerPasswordBroker() protected function registerPasswordBroker()
{ {
......
...@@ -65,7 +65,7 @@ class Collection ...@@ -65,7 +65,7 @@ class Collection
} }
} }
$queryString = $this->collection->getCollectionName() . '.' . $method . '(' . implode(',', $query) . ')'; $queryString = $this->collection->getCollectionName().'.'.$method.'('.implode(',', $query).')';
$this->connection->logQuery($queryString, [], $time); $this->connection->logQuery($queryString, [], $time);
} }
......
...@@ -85,7 +85,7 @@ class Connection extends BaseConnection ...@@ -85,7 +85,7 @@ class Connection extends BaseConnection
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getSchemaBuilder() public function getSchemaBuilder()
{ {
...@@ -119,7 +119,7 @@ class Connection extends BaseConnection ...@@ -119,7 +119,7 @@ class Connection extends BaseConnection
} }
/** /**
* Get the name of the default database based on db config or try to detect it from dsn * Get the name of the default database based on db config or try to detect it from dsn.
* @param string $dsn * @param string $dsn
* @param array $config * @param array $config
* @return string * @return string
...@@ -131,7 +131,7 @@ class Connection extends BaseConnection ...@@ -131,7 +131,7 @@ class Connection extends BaseConnection
if (preg_match('/^mongodb(?:[+]srv)?:\\/\\/.+\\/([^?&]+)/s', $dsn, $matches)) { if (preg_match('/^mongodb(?:[+]srv)?:\\/\\/.+\\/([^?&]+)/s', $dsn, $matches)) {
$config['database'] = $matches[1]; $config['database'] = $matches[1];
} else { } else {
throw new InvalidArgumentException("Database is not properly configured."); throw new InvalidArgumentException('Database is not properly configured.');
} }
} }
...@@ -155,10 +155,10 @@ class Connection extends BaseConnection ...@@ -155,10 +155,10 @@ class Connection extends BaseConnection
} }
// Check if the credentials are not already set in the options // Check if the credentials are not already set in the options
if (!isset($options['username']) && !empty($config['username'])) { if (! isset($options['username']) && ! empty($config['username'])) {
$options['username'] = $config['username']; $options['username'] = $config['username'];
} }
if (!isset($options['password']) && !empty($config['password'])) { if (! isset($options['password']) && ! empty($config['password'])) {
$options['password'] = $config['password']; $options['password'] = $config['password'];
} }
...@@ -166,7 +166,7 @@ class Connection extends BaseConnection ...@@ -166,7 +166,7 @@ class Connection extends BaseConnection
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function disconnect() public function disconnect()
{ {
...@@ -180,7 +180,7 @@ class Connection extends BaseConnection ...@@ -180,7 +180,7 @@ class Connection extends BaseConnection
*/ */
protected function hasDsnString(array $config) protected function hasDsnString(array $config)
{ {
return isset($config['dsn']) && !empty($config['dsn']); return isset($config['dsn']) && ! empty($config['dsn']);
} }
/** /**
...@@ -205,14 +205,15 @@ class Connection extends BaseConnection ...@@ -205,14 +205,15 @@ class Connection extends BaseConnection
foreach ($hosts as &$host) { foreach ($hosts as &$host) {
// Check if we need to add a port to the host // Check if we need to add a port to the host
if (strpos($host, ':') === false && !empty($config['port'])) { if (strpos($host, ':') === false && ! empty($config['port'])) {
$host = $host . ':' . $config['port']; $host = $host.':'.$config['port'];
} }
} }
// Check if we want to authenticate against a specific database. // Check if we want to authenticate against a specific database.
$auth_database = isset($config['options']) && !empty($config['options']['database']) ? $config['options']['database'] : null; $auth_database = isset($config['options']) && ! empty($config['options']['database']) ? $config['options']['database'] : null;
return 'mongodb://' . implode(',', $hosts) . ($auth_database ? '/' . $auth_database : '');
return 'mongodb://'.implode(',', $hosts).($auth_database ? '/'.$auth_database : '');
} }
/** /**
...@@ -228,7 +229,7 @@ class Connection extends BaseConnection ...@@ -228,7 +229,7 @@ class Connection extends BaseConnection
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getElapsedTime($start) public function getElapsedTime($start)
{ {
...@@ -236,7 +237,7 @@ class Connection extends BaseConnection ...@@ -236,7 +237,7 @@ class Connection extends BaseConnection
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getDriverName() public function getDriverName()
{ {
...@@ -244,7 +245,7 @@ class Connection extends BaseConnection ...@@ -244,7 +245,7 @@ class Connection extends BaseConnection
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function getDefaultPostProcessor() protected function getDefaultPostProcessor()
{ {
...@@ -252,7 +253,7 @@ class Connection extends BaseConnection ...@@ -252,7 +253,7 @@ class Connection extends BaseConnection
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function getDefaultQueryGrammar() protected function getDefaultQueryGrammar()
{ {
...@@ -260,7 +261,7 @@ class Connection extends BaseConnection ...@@ -260,7 +261,7 @@ class Connection extends BaseConnection
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function getDefaultSchemaGrammar() protected function getDefaultSchemaGrammar()
{ {
......
...@@ -31,7 +31,7 @@ class Builder extends EloquentBuilder ...@@ -31,7 +31,7 @@ class Builder extends EloquentBuilder
]; ];
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function update(array $values, array $options = []) public function update(array $values, array $options = [])
{ {
...@@ -39,7 +39,7 @@ class Builder extends EloquentBuilder ...@@ -39,7 +39,7 @@ class Builder extends EloquentBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function insert(array $values) public function insert(array $values)
{ {
...@@ -47,7 +47,7 @@ class Builder extends EloquentBuilder ...@@ -47,7 +47,7 @@ class Builder extends EloquentBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function insertGetId(array $values, $sequence = null) public function insertGetId(array $values, $sequence = null)
{ {
...@@ -55,7 +55,7 @@ class Builder extends EloquentBuilder ...@@ -55,7 +55,7 @@ class Builder extends EloquentBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function delete() public function delete()
{ {
...@@ -63,7 +63,7 @@ class Builder extends EloquentBuilder ...@@ -63,7 +63,7 @@ class Builder extends EloquentBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function increment($column, $amount = 1, array $extra = []) public function increment($column, $amount = 1, array $extra = [])
{ {
...@@ -71,7 +71,7 @@ class Builder extends EloquentBuilder ...@@ -71,7 +71,7 @@ class Builder extends EloquentBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function decrement($column, $amount = 1, array $extra = []) public function decrement($column, $amount = 1, array $extra = [])
{ {
...@@ -79,7 +79,7 @@ class Builder extends EloquentBuilder ...@@ -79,7 +79,7 @@ class Builder extends EloquentBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function chunkById($count, callable $callback, $column = '_id', $alias = null) public function chunkById($count, callable $callback, $column = '_id', $alias = null)
{ {
...@@ -87,7 +87,7 @@ class Builder extends EloquentBuilder ...@@ -87,7 +87,7 @@ class Builder extends EloquentBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function raw($expression = null) public function raw($expression = null)
{ {
...@@ -116,13 +116,13 @@ class Builder extends EloquentBuilder ...@@ -116,13 +116,13 @@ class Builder extends EloquentBuilder
* Add the "updated at" column to an array of values. * Add the "updated at" column to an array of values.
* TODO Remove if https://github.com/laravel/framework/commit/6484744326531829341e1ff886cc9b628b20d73e * TODO Remove if https://github.com/laravel/framework/commit/6484744326531829341e1ff886cc9b628b20d73e
* wiil be reverted * wiil be reverted
* Issue in laravel frawework https://github.com/laravel/framework/issues/27791 * Issue in laravel frawework https://github.com/laravel/framework/issues/27791.
* @param array $values * @param array $values
* @return array * @return array
*/ */
protected function addUpdatedAtColumn(array $values) protected function addUpdatedAtColumn(array $values)
{ {
if (!$this->model->usesTimestamps() || $this->model->getUpdatedAtColumn() === null) { if (! $this->model->usesTimestamps() || $this->model->getUpdatedAtColumn() === null) {
return $values; return $values;
} }
......
...@@ -9,8 +9,8 @@ use Jenssegers\Mongodb\Relations\BelongsTo; ...@@ -9,8 +9,8 @@ use Jenssegers\Mongodb\Relations\BelongsTo;
use Jenssegers\Mongodb\Relations\BelongsToMany; use Jenssegers\Mongodb\Relations\BelongsToMany;
use Jenssegers\Mongodb\Relations\HasMany; use Jenssegers\Mongodb\Relations\HasMany;
use Jenssegers\Mongodb\Relations\HasOne; use Jenssegers\Mongodb\Relations\HasOne;
use Jenssegers\Mongodb\Relations\MorphTo;
use Jenssegers\Mongodb\Relations\MorphMany; use Jenssegers\Mongodb\Relations\MorphMany;
use Jenssegers\Mongodb\Relations\MorphTo;
trait HybridRelations trait HybridRelations
{ {
...@@ -24,7 +24,7 @@ trait HybridRelations ...@@ -24,7 +24,7 @@ trait HybridRelations
public function hasOne($related, $foreignKey = null, $localKey = null) public function hasOne($related, $foreignKey = null, $localKey = null)
{ {
// Check if it is a relation with an original model. // Check if it is a relation with an original model.
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) { if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
return parent::hasOne($related, $foreignKey, $localKey); return parent::hasOne($related, $foreignKey, $localKey);
} }
...@@ -49,13 +49,13 @@ trait HybridRelations ...@@ -49,13 +49,13 @@ trait HybridRelations
public function morphOne($related, $name, $type = null, $id = null, $localKey = null) public function morphOne($related, $name, $type = null, $id = null, $localKey = null)
{ {
// Check if it is a relation with an original model. // Check if it is a relation with an original model.
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) { if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
return parent::morphOne($related, $name, $type, $id, $localKey); return parent::morphOne($related, $name, $type, $id, $localKey);
} }
$instance = new $related; $instance = new $related;
list($type, $id) = $this->getMorphs($name, $type, $id); [$type, $id] = $this->getMorphs($name, $type, $id);
$localKey = $localKey ?: $this->getKeyName(); $localKey = $localKey ?: $this->getKeyName();
...@@ -72,7 +72,7 @@ trait HybridRelations ...@@ -72,7 +72,7 @@ trait HybridRelations
public function hasMany($related, $foreignKey = null, $localKey = null) public function hasMany($related, $foreignKey = null, $localKey = null)
{ {
// Check if it is a relation with an original model. // Check if it is a relation with an original model.
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) { if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
return parent::hasMany($related, $foreignKey, $localKey); return parent::hasMany($related, $foreignKey, $localKey);
} }
...@@ -97,7 +97,7 @@ trait HybridRelations ...@@ -97,7 +97,7 @@ trait HybridRelations
public function morphMany($related, $name, $type = null, $id = null, $localKey = null) public function morphMany($related, $name, $type = null, $id = null, $localKey = null)
{ {
// Check if it is a relation with an original model. // Check if it is a relation with an original model.
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) { if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
return parent::morphMany($related, $name, $type, $id, $localKey); return parent::morphMany($related, $name, $type, $id, $localKey);
} }
...@@ -106,7 +106,7 @@ trait HybridRelations ...@@ -106,7 +106,7 @@ trait HybridRelations
// Here we will gather up the morph type and ID for the relationship so that we // Here we will gather up the morph type and ID for the relationship so that we
// can properly query the intermediate table of a relation. Finally, we will // can properly query the intermediate table of a relation. Finally, we will
// get the table and create the relationship instances for the developers. // get the table and create the relationship instances for the developers.
list($type, $id) = $this->getMorphs($name, $type, $id); [$type, $id] = $this->getMorphs($name, $type, $id);
$table = $instance->getTable(); $table = $instance->getTable();
...@@ -129,13 +129,13 @@ trait HybridRelations ...@@ -129,13 +129,13 @@ trait HybridRelations
// the calling method's name and use that as the relationship name as most // the calling method's name and use that as the relationship name as most
// of the time this will be what we desire to use for the relationships. // of the time this will be what we desire to use for the relationships.
if ($relation === null) { if ($relation === null) {
list($current, $caller) = debug_backtrace(false, 2); [$current, $caller] = debug_backtrace(false, 2);
$relation = $caller['function']; $relation = $caller['function'];
} }
// Check if it is a relation with an original model. // Check if it is a relation with an original model.
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) { if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
return parent::belongsTo($related, $foreignKey, $otherKey, $relation); return parent::belongsTo($related, $foreignKey, $otherKey, $relation);
} }
...@@ -143,7 +143,7 @@ trait HybridRelations ...@@ -143,7 +143,7 @@ trait HybridRelations
// foreign key name by using the name of the relationship function, which // foreign key name by using the name of the relationship function, which
// when combined with an "_id" should conventionally match the columns. // when combined with an "_id" should conventionally match the columns.
if ($foreignKey === null) { if ($foreignKey === null) {
$foreignKey = Str::snake($relation) . '_id'; $foreignKey = Str::snake($relation).'_id';
} }
$instance = new $related; $instance = new $related;
...@@ -172,12 +172,12 @@ trait HybridRelations ...@@ -172,12 +172,12 @@ trait HybridRelations
// since that is most likely the name of the polymorphic interface. We can // since that is most likely the name of the polymorphic interface. We can
// use that to get both the class and foreign key that will be utilized. // use that to get both the class and foreign key that will be utilized.
if ($name === null) { if ($name === null) {
list($current, $caller) = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); [$current, $caller] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
$name = Str::snake($caller['function']); $name = Str::snake($caller['function']);
} }
list($type, $id) = $this->getMorphs($name, $type, $id); [$type, $id] = $this->getMorphs($name, $type, $id);
// If the type value is null it is probably safe to assume we're eager loading // If the type value is null it is probably safe to assume we're eager loading
// the relationship. When that is the case we will pass in a dummy query as // the relationship. When that is the case we will pass in a dummy query as
...@@ -230,7 +230,7 @@ trait HybridRelations ...@@ -230,7 +230,7 @@ trait HybridRelations
} }
// Check if it is a relation with an original model. // Check if it is a relation with an original model.
if (!is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) { if (! is_subclass_of($related, \Jenssegers\Mongodb\Eloquent\Model::class)) {
return parent::belongsToMany( return parent::belongsToMany(
$related, $related,
$collection, $collection,
...@@ -245,11 +245,11 @@ trait HybridRelations ...@@ -245,11 +245,11 @@ trait HybridRelations
// First, we'll need to determine the foreign key and "other key" for the // First, we'll need to determine the foreign key and "other key" for the
// relationship. Once we have determined the keys we'll make the query // relationship. Once we have determined the keys we'll make the query
// instances as well as the relationship instances we need for this. // instances as well as the relationship instances we need for this.
$foreignKey = $foreignKey ?: $this->getForeignKey() . 's'; $foreignKey = $foreignKey ?: $this->getForeignKey().'s';
$instance = new $related; $instance = new $related;
$otherKey = $otherKey ?: $instance->getForeignKey() . 's'; $otherKey = $otherKey ?: $instance->getForeignKey().'s';
// If no table name was provided, we can guess it by concatenating the two // If no table name was provided, we can guess it by concatenating the two
// models using underscores in alphabetical order. The two model names // models using underscores in alphabetical order. The two model names
...@@ -289,7 +289,7 @@ trait HybridRelations ...@@ -289,7 +289,7 @@ trait HybridRelations
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function newEloquentBuilder($query) public function newEloquentBuilder($query)
{ {
......
...@@ -52,7 +52,7 @@ abstract class Model extends BaseModel ...@@ -52,7 +52,7 @@ abstract class Model extends BaseModel
{ {
// If we don't have a value for 'id', we will use the Mongo '_id' value. // If we don't have a value for 'id', we will use the Mongo '_id' value.
// This allows us to work with models in a more sql-like way. // This allows us to work with models in a more sql-like way.
if (!$value && array_key_exists('_id', $this->attributes)) { if (! $value && array_key_exists('_id', $this->attributes)) {
$value = $this->attributes['_id']; $value = $this->attributes['_id'];
} }
...@@ -67,7 +67,7 @@ abstract class Model extends BaseModel ...@@ -67,7 +67,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getQualifiedKeyName() public function getQualifiedKeyName()
{ {
...@@ -75,7 +75,7 @@ abstract class Model extends BaseModel ...@@ -75,7 +75,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function fromDateTime($value) public function fromDateTime($value)
{ {
...@@ -85,7 +85,7 @@ abstract class Model extends BaseModel ...@@ -85,7 +85,7 @@ abstract class Model extends BaseModel
} }
// Let Eloquent convert the value to a DateTime instance. // Let Eloquent convert the value to a DateTime instance.
if (!$value instanceof DateTime) { if (! $value instanceof DateTime) {
$value = parent::asDateTime($value); $value = parent::asDateTime($value);
} }
...@@ -93,7 +93,7 @@ abstract class Model extends BaseModel ...@@ -93,7 +93,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function asDateTime($value) protected function asDateTime($value)
{ {
...@@ -106,7 +106,7 @@ abstract class Model extends BaseModel ...@@ -106,7 +106,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getDateFormat() public function getDateFormat()
{ {
...@@ -114,7 +114,7 @@ abstract class Model extends BaseModel ...@@ -114,7 +114,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function freshTimestamp() public function freshTimestamp()
{ {
...@@ -122,7 +122,7 @@ abstract class Model extends BaseModel ...@@ -122,7 +122,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getTable() public function getTable()
{ {
...@@ -130,11 +130,11 @@ abstract class Model extends BaseModel ...@@ -130,11 +130,11 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getAttribute($key) public function getAttribute($key)
{ {
if (!$key) { if (! $key) {
return; return;
} }
...@@ -147,7 +147,7 @@ abstract class Model extends BaseModel ...@@ -147,7 +147,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function getAttributeFromArray($key) protected function getAttributeFromArray($key)
{ {
...@@ -160,7 +160,7 @@ abstract class Model extends BaseModel ...@@ -160,7 +160,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function setAttribute($key, $value) public function setAttribute($key, $value)
{ {
...@@ -184,7 +184,7 @@ abstract class Model extends BaseModel ...@@ -184,7 +184,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function attributesToArray() public function attributesToArray()
{ {
...@@ -213,7 +213,7 @@ abstract class Model extends BaseModel ...@@ -213,7 +213,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getCasts() public function getCasts()
{ {
...@@ -221,11 +221,11 @@ abstract class Model extends BaseModel ...@@ -221,11 +221,11 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function originalIsEquivalent($key, $current) public function originalIsEquivalent($key, $current)
{ {
if (!array_key_exists($key, $this->original)) { if (! array_key_exists($key, $this->original)) {
return false; return false;
} }
...@@ -274,7 +274,7 @@ abstract class Model extends BaseModel ...@@ -274,7 +274,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function push() public function push()
{ {
...@@ -282,9 +282,9 @@ abstract class Model extends BaseModel ...@@ -282,9 +282,9 @@ abstract class Model extends BaseModel
$unique = false; $unique = false;
if (count($parameters) === 3) { if (count($parameters) === 3) {
list($column, $values, $unique) = $parameters; [$column, $values, $unique] = $parameters;
} else { } else {
list($column, $values) = $parameters; [$column, $values] = $parameters;
} }
// Do batch push by default. // Do batch push by default.
...@@ -330,7 +330,7 @@ abstract class Model extends BaseModel ...@@ -330,7 +330,7 @@ abstract class Model extends BaseModel
foreach ($values as $value) { foreach ($values as $value) {
// Don't add duplicate values when we only want unique values. // Don't add duplicate values when we only want unique values.
if ($unique && (!is_array($current) || in_array($value, $current))) { if ($unique && (! is_array($current) || in_array($value, $current))) {
continue; continue;
} }
...@@ -367,11 +367,11 @@ abstract class Model extends BaseModel ...@@ -367,11 +367,11 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getForeignKey() public function getForeignKey()
{ {
return Str::snake(class_basename($this)) . '_' . ltrim($this->primaryKey, '_'); return Str::snake(class_basename($this)).'_'.ltrim($this->primaryKey, '_');
} }
/** /**
...@@ -393,7 +393,7 @@ abstract class Model extends BaseModel ...@@ -393,7 +393,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function newEloquentBuilder($query) public function newEloquentBuilder($query)
{ {
...@@ -401,7 +401,7 @@ abstract class Model extends BaseModel ...@@ -401,7 +401,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function newBaseQueryBuilder() protected function newBaseQueryBuilder()
{ {
...@@ -411,7 +411,7 @@ abstract class Model extends BaseModel ...@@ -411,7 +411,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function removeTableFromKey($key) protected function removeTableFromKey($key)
{ {
...@@ -433,13 +433,13 @@ abstract class Model extends BaseModel ...@@ -433,13 +433,13 @@ abstract class Model extends BaseModel
if ($relation instanceof QueueableCollection) { if ($relation instanceof QueueableCollection) {
foreach ($relation->getQueueableRelations() as $collectionValue) { foreach ($relation->getQueueableRelations() as $collectionValue) {
$relations[] = $key . '.' . $collectionValue; $relations[] = $key.'.'.$collectionValue;
} }
} }
if ($relation instanceof QueueableEntity) { if ($relation instanceof QueueableEntity) {
foreach ($relation->getQueueableRelations() as $entityKey => $entityValue) { foreach ($relation->getQueueableRelations() as $entityKey => $entityValue) {
$relations[] = $key . '.' . $entityValue; $relations[] = $key.'.'.$entityValue;
} }
} }
} }
...@@ -463,7 +463,7 @@ abstract class Model extends BaseModel ...@@ -463,7 +463,7 @@ abstract class Model extends BaseModel
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function __call($method, $parameters) public function __call($method, $parameters)
{ {
......
...@@ -7,7 +7,7 @@ trait SoftDeletes ...@@ -7,7 +7,7 @@ trait SoftDeletes
use \Illuminate\Database\Eloquent\SoftDeletes; use \Illuminate\Database\Eloquent\SoftDeletes;
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getQualifiedDeletedAtColumn() public function getQualifiedDeletedAtColumn()
{ {
......
...@@ -71,7 +71,7 @@ trait QueriesRelationships ...@@ -71,7 +71,7 @@ trait QueriesRelationships
} }
/** /**
* Compare across databases * Compare across databases.
* @param Relation $relation * @param Relation $relation
* @param string $operator * @param string $operator
* @param int $count * @param int $count
...@@ -91,7 +91,7 @@ trait QueriesRelationships ...@@ -91,7 +91,7 @@ trait QueriesRelationships
$not = in_array($operator, ['<', '<=', '!=']); $not = in_array($operator, ['<', '<=', '!=']);
// If we are comparing to 0, we need an additional $not flip. // If we are comparing to 0, we need an additional $not flip.
if ($count == 0) { if ($count == 0) {
$not = !$not; $not = ! $not;
} }
$relations = $hasQuery->pluck($this->getHasCompareKey($relation)); $relations = $hasQuery->pluck($this->getHasCompareKey($relation));
...@@ -149,7 +149,7 @@ trait QueriesRelationships ...@@ -149,7 +149,7 @@ trait QueriesRelationships
} }
/** /**
* Returns key we are constraining this parent model's query with * Returns key we are constraining this parent model's query with.
* @param Relation $relation * @param Relation $relation
* @return string * @return string
* @throws Exception * @throws Exception
...@@ -164,10 +164,10 @@ trait QueriesRelationships ...@@ -164,10 +164,10 @@ trait QueriesRelationships
return $relation->getForeignKeyName(); return $relation->getForeignKeyName();
} }
if ($relation instanceof BelongsToMany && !$this->isAcrossConnections($relation)) { if ($relation instanceof BelongsToMany && ! $this->isAcrossConnections($relation)) {
return $this->model->getKeyName(); return $this->model->getKeyName();
} }
throw new Exception(class_basename($relation) . ' is not supported for hybrid query constraints.'); throw new Exception(class_basename($relation).' is not supported for hybrid query constraints.');
} }
} }
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
namespace Jenssegers\Mongodb; namespace Jenssegers\Mongodb;
use Illuminate\Support\Facades\DB;
use Illuminate\Queue\QueueServiceProvider; use Illuminate\Queue\QueueServiceProvider;
use Illuminate\Support\Facades\DB;
use Jenssegers\Mongodb\Queue\Failed\MongoFailedJobProvider; use Jenssegers\Mongodb\Queue\Failed\MongoFailedJobProvider;
class MongodbQueueServiceProvider extends QueueServiceProvider class MongodbQueueServiceProvider extends QueueServiceProvider
{ {
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function registerFailedJobServices() protected function registerFailedJobServices()
{ {
......
...@@ -27,6 +27,7 @@ class MongodbServiceProvider extends ServiceProvider ...@@ -27,6 +27,7 @@ class MongodbServiceProvider extends ServiceProvider
$this->app->resolving('db', function ($db) { $this->app->resolving('db', function ($db) {
$db->extend('mongodb', function ($config, $name) { $db->extend('mongodb', function ($config, $name) {
$config['name'] = $name; $config['name'] = $name;
return new Connection($config); return new Connection($config);
}); });
}); });
......
...@@ -116,7 +116,7 @@ class Builder extends BaseBuilder ...@@ -116,7 +116,7 @@ class Builder extends BaseBuilder
]; ];
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function __construct(Connection $connection, Processor $processor) public function __construct(Connection $connection, Processor $processor)
{ {
...@@ -162,7 +162,7 @@ class Builder extends BaseBuilder ...@@ -162,7 +162,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function find($id, $columns = []) public function find($id, $columns = [])
{ {
...@@ -170,7 +170,7 @@ class Builder extends BaseBuilder ...@@ -170,7 +170,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function value($column) public function value($column)
{ {
...@@ -180,7 +180,7 @@ class Builder extends BaseBuilder ...@@ -180,7 +180,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function get($columns = []) public function get($columns = [])
{ {
...@@ -217,18 +217,18 @@ class Builder extends BaseBuilder ...@@ -217,18 +217,18 @@ class Builder extends BaseBuilder
// Add grouping columns to the $group part of the aggregation pipeline. // Add grouping columns to the $group part of the aggregation pipeline.
if ($this->groups) { if ($this->groups) {
foreach ($this->groups as $column) { foreach ($this->groups as $column) {
$group['_id'][$column] = '$' . $column; $group['_id'][$column] = '$'.$column;
// When grouping, also add the $last operator to each grouped field, // When grouping, also add the $last operator to each grouped field,
// this mimics MySQL's behaviour a bit. // this mimics MySQL's behaviour a bit.
$group[$column] = ['$last' => '$' . $column]; $group[$column] = ['$last' => '$'.$column];
} }
// Do the same for other columns that are selected. // Do the same for other columns that are selected.
foreach ($this->columns as $column) { foreach ($this->columns as $column) {
$key = str_replace('.', '_', $column); $key = str_replace('.', '_', $column);
$group[$key] = ['$last' => '$' . $column]; $group[$key] = ['$last' => '$'.$column];
} }
} }
...@@ -260,15 +260,16 @@ class Builder extends BaseBuilder ...@@ -260,15 +260,16 @@ class Builder extends BaseBuilder
$results = [ $results = [
[ [
'_id' => null, '_id' => null,
'aggregate' => $totalResults 'aggregate' => $totalResults,
] ],
]; ];
return new Collection($results); return new Collection($results);
} elseif ($function == 'count') { } elseif ($function == 'count') {
// Translate count into sum. // Translate count into sum.
$group['aggregate'] = ['$sum' => 1]; $group['aggregate'] = ['$sum' => 1];
} else { } else {
$group['aggregate'] = ['$' . $function => '$' . $column]; $group['aggregate'] = ['$'.$function => '$'.$column];
} }
} }
} }
...@@ -286,7 +287,7 @@ class Builder extends BaseBuilder ...@@ -286,7 +287,7 @@ class Builder extends BaseBuilder
// apply unwinds for subdocument array aggregation // apply unwinds for subdocument array aggregation
foreach ($unwinds as $unwind) { foreach ($unwinds as $unwind) {
$pipeline[] = ['$unwind' => '$' . $unwind]; $pipeline[] = ['$unwind' => '$'.$unwind];
} }
if ($group) { if ($group) {
...@@ -382,6 +383,7 @@ class Builder extends BaseBuilder ...@@ -382,6 +383,7 @@ class Builder extends BaseBuilder
// Return results as an array with numeric keys // Return results as an array with numeric keys
$results = iterator_to_array($cursor, false); $results = iterator_to_array($cursor, false);
return new Collection($results); return new Collection($results);
} }
} }
...@@ -408,7 +410,7 @@ class Builder extends BaseBuilder ...@@ -408,7 +410,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function aggregate($function, $columns = []) public function aggregate($function, $columns = [])
{ {
...@@ -440,7 +442,7 @@ class Builder extends BaseBuilder ...@@ -440,7 +442,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function exists() public function exists()
{ {
...@@ -448,7 +450,7 @@ class Builder extends BaseBuilder ...@@ -448,7 +450,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function distinct($column = false) public function distinct($column = false)
{ {
...@@ -462,7 +464,7 @@ class Builder extends BaseBuilder ...@@ -462,7 +464,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function orderBy($column, $direction = 'asc') public function orderBy($column, $direction = 'asc')
{ {
...@@ -497,7 +499,7 @@ class Builder extends BaseBuilder ...@@ -497,7 +499,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function whereBetween($column, array $values, $boolean = 'and', $not = false) public function whereBetween($column, array $values, $boolean = 'and', $not = false)
{ {
...@@ -509,7 +511,7 @@ class Builder extends BaseBuilder ...@@ -509,7 +511,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function forPage($page, $perPage = 15) public function forPage($page, $perPage = 15)
{ {
...@@ -519,7 +521,7 @@ class Builder extends BaseBuilder ...@@ -519,7 +521,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function insert(array $values) public function insert(array $values)
{ {
...@@ -530,24 +532,24 @@ class Builder extends BaseBuilder ...@@ -530,24 +532,24 @@ class Builder extends BaseBuilder
foreach ($values as $value) { foreach ($values as $value) {
// As soon as we find a value that is not an array we assume the user is // As soon as we find a value that is not an array we assume the user is
// inserting a single document. // inserting a single document.
if (!is_array($value)) { if (! is_array($value)) {
$batch = false; $batch = false;
break; break;
} }
} }
if (!$batch) { if (! $batch) {
$values = [$values]; $values = [$values];
} }
// Batch insert // Batch insert
$result = $this->collection->insertMany($values); $result = $this->collection->insertMany($values);
return (1 == (int) $result->isAcknowledged()); return 1 == (int) $result->isAcknowledged();
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function insertGetId(array $values, $sequence = null) public function insertGetId(array $values, $sequence = null)
{ {
...@@ -564,12 +566,12 @@ class Builder extends BaseBuilder ...@@ -564,12 +566,12 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function update(array $values, array $options = []) public function update(array $values, array $options = [])
{ {
// Use $set as default operator. // Use $set as default operator.
if (!Str::startsWith(key($values), '$')) { if (! Str::startsWith(key($values), '$')) {
$values = ['$set' => $values]; $values = ['$set' => $values];
} }
...@@ -577,13 +579,13 @@ class Builder extends BaseBuilder ...@@ -577,13 +579,13 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function increment($column, $amount = 1, array $extra = [], array $options = []) public function increment($column, $amount = 1, array $extra = [], array $options = [])
{ {
$query = ['$inc' => [$column => $amount]]; $query = ['$inc' => [$column => $amount]];
if (!empty($extra)) { if (! empty($extra)) {
$query['$set'] = $extra; $query['$set'] = $extra;
} }
...@@ -598,7 +600,7 @@ class Builder extends BaseBuilder ...@@ -598,7 +600,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function decrement($column, $amount = 1, array $extra = [], array $options = []) public function decrement($column, $amount = 1, array $extra = [], array $options = [])
{ {
...@@ -606,7 +608,7 @@ class Builder extends BaseBuilder ...@@ -606,7 +608,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function chunkById($count, callable $callback, $column = '_id', $alias = null) public function chunkById($count, callable $callback, $column = '_id', $alias = null)
{ {
...@@ -614,7 +616,7 @@ class Builder extends BaseBuilder ...@@ -614,7 +616,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function forPageAfterId($perPage = 15, $lastId = 0, $column = '_id') public function forPageAfterId($perPage = 15, $lastId = 0, $column = '_id')
{ {
...@@ -622,7 +624,7 @@ class Builder extends BaseBuilder ...@@ -622,7 +624,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function pluck($column, $key = null) public function pluck($column, $key = null)
{ {
...@@ -632,16 +634,18 @@ class Builder extends BaseBuilder ...@@ -632,16 +634,18 @@ class Builder extends BaseBuilder
if ($key == '_id') { if ($key == '_id') {
$results = $results->map(function ($item) { $results = $results->map(function ($item) {
$item['_id'] = (string) $item['_id']; $item['_id'] = (string) $item['_id'];
return $item; return $item;
}); });
} }
$p = Arr::pluck($results, $column, $key); $p = Arr::pluck($results, $column, $key);
return new Collection($p); return new Collection($p);
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function delete($id = null) public function delete($id = null)
{ {
...@@ -662,7 +666,7 @@ class Builder extends BaseBuilder ...@@ -662,7 +666,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function from($collection, $as = null) public function from($collection, $as = null)
{ {
...@@ -674,7 +678,7 @@ class Builder extends BaseBuilder ...@@ -674,7 +678,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function truncate() public function truncate()
{ {
...@@ -684,7 +688,7 @@ class Builder extends BaseBuilder ...@@ -684,7 +688,7 @@ class Builder extends BaseBuilder
$result = $this->collection->drop($options); $result = $this->collection->drop($options);
return (1 == (int) $result->ok); return 1 == (int) $result->ok;
} }
/** /**
...@@ -700,7 +704,7 @@ class Builder extends BaseBuilder ...@@ -700,7 +704,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function raw($expression = null) public function raw($expression = null)
{ {
...@@ -774,7 +778,7 @@ class Builder extends BaseBuilder ...@@ -774,7 +778,7 @@ class Builder extends BaseBuilder
*/ */
public function drop($columns) public function drop($columns)
{ {
if (!is_array($columns)) { if (! is_array($columns)) {
$columns = [$columns]; $columns = [$columns];
} }
...@@ -790,11 +794,11 @@ class Builder extends BaseBuilder ...@@ -790,11 +794,11 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function newQuery() public function newQuery()
{ {
return new Builder($this->connection, $this->processor); return new self($this->connection, $this->processor);
} }
/** /**
...@@ -806,7 +810,7 @@ class Builder extends BaseBuilder ...@@ -806,7 +810,7 @@ class Builder extends BaseBuilder
protected function performUpdate($query, array $options = []) protected function performUpdate($query, array $options = [])
{ {
// Update multiple items by default. // Update multiple items by default.
if (!array_key_exists('multiple', $options)) { if (! array_key_exists('multiple', $options)) {
$options['multiple'] = true; $options['multiple'] = true;
} }
...@@ -838,7 +842,7 @@ class Builder extends BaseBuilder ...@@ -838,7 +842,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function where($column, $operator = null, $value = null, $boolean = 'and') public function where($column, $operator = null, $value = null, $boolean = 'and')
{ {
...@@ -984,10 +988,10 @@ class Builder extends BaseBuilder ...@@ -984,10 +988,10 @@ class Builder extends BaseBuilder
$regex = preg_replace('#(^|[^\\\])%#', '$1.*', preg_quote($value)); $regex = preg_replace('#(^|[^\\\])%#', '$1.*', preg_quote($value));
// Convert like to regular expression. // Convert like to regular expression.
if (!Str::startsWith($value, '%')) { if (! Str::startsWith($value, '%')) {
$regex = '^' . $regex; $regex = '^'.$regex;
} }
if (!Str::endsWith($value, '%')) { if (! Str::endsWith($value, '%')) {
$regex .= '$'; $regex .= '$';
} }
...@@ -995,7 +999,7 @@ class Builder extends BaseBuilder ...@@ -995,7 +999,7 @@ class Builder extends BaseBuilder
} // Manipulate regexp operations. } // Manipulate regexp operations.
elseif (in_array($operator, ['regexp', 'not regexp', 'regex', 'not regex'])) { elseif (in_array($operator, ['regexp', 'not regexp', 'regex', 'not regex'])) {
// Automatically convert regular expression strings to Regex objects. // Automatically convert regular expression strings to Regex objects.
if (!$value instanceof Regex) { if (! $value instanceof Regex) {
$e = explode('/', $value); $e = explode('/', $value);
$flag = end($e); $flag = end($e);
$regstr = substr($value, 1, -(strlen($flag) + 1)); $regstr = substr($value, 1, -(strlen($flag) + 1));
...@@ -1009,12 +1013,12 @@ class Builder extends BaseBuilder ...@@ -1009,12 +1013,12 @@ class Builder extends BaseBuilder
} }
} }
if (!isset($operator) || $operator == '=') { if (! isset($operator) || $operator == '=') {
$query = [$column => $value]; $query = [$column => $value];
} elseif (array_key_exists($operator, $this->conversion)) { } elseif (array_key_exists($operator, $this->conversion)) {
$query = [$column => [$this->conversion[$operator] => $value]]; $query = [$column => [$this->conversion[$operator] => $value]];
} else { } else {
$query = [$column => ['$' . $operator => $value]]; $query = [$column => ['$'.$operator => $value]];
} }
return $query; return $query;
...@@ -1132,7 +1136,7 @@ class Builder extends BaseBuilder ...@@ -1132,7 +1136,7 @@ class Builder extends BaseBuilder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function __call($method, $parameters) public function __call($method, $parameters)
{ {
......
...@@ -34,6 +34,7 @@ class MongoFailedJobProvider extends DatabaseFailedJobProvider ...@@ -34,6 +34,7 @@ class MongoFailedJobProvider extends DatabaseFailedJobProvider
$all = array_map(function ($job) { $all = array_map(function ($job) {
$job['id'] = (string) $job['_id']; $job['id'] = (string) $job['_id'];
return (object) $job; return (object) $job;
}, $all); }, $all);
...@@ -49,7 +50,7 @@ class MongoFailedJobProvider extends DatabaseFailedJobProvider ...@@ -49,7 +50,7 @@ class MongoFailedJobProvider extends DatabaseFailedJobProvider
{ {
$job = $this->getTable()->find($id); $job = $this->getTable()->find($id);
if (!$job) { if (! $job) {
return; return;
} }
......
...@@ -22,7 +22,7 @@ class MongoQueue extends DatabaseQueue ...@@ -22,7 +22,7 @@ class MongoQueue extends DatabaseQueue
protected $connectionName; protected $connectionName;
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function __construct(Connection $database, $table, $default = 'default', $retryAfter = 60) public function __construct(Connection $database, $table, $default = 'default', $retryAfter = 60)
{ {
...@@ -31,7 +31,7 @@ class MongoQueue extends DatabaseQueue ...@@ -31,7 +31,7 @@ class MongoQueue extends DatabaseQueue
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function pop($queue = null) public function pop($queue = null)
{ {
...@@ -125,7 +125,7 @@ class MongoQueue extends DatabaseQueue ...@@ -125,7 +125,7 @@ class MongoQueue extends DatabaseQueue
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function deleteReserved($queue, $id) public function deleteReserved($queue, $id)
{ {
......
...@@ -17,7 +17,7 @@ class BelongsTo extends \Illuminate\Database\Eloquent\Relations\BelongsTo ...@@ -17,7 +17,7 @@ class BelongsTo extends \Illuminate\Database\Eloquent\Relations\BelongsTo
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function addConstraints() public function addConstraints()
{ {
...@@ -30,7 +30,7 @@ class BelongsTo extends \Illuminate\Database\Eloquent\Relations\BelongsTo ...@@ -30,7 +30,7 @@ class BelongsTo extends \Illuminate\Database\Eloquent\Relations\BelongsTo
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function addEagerConstraints(array $models) public function addEagerConstraints(array $models)
{ {
...@@ -43,7 +43,7 @@ class BelongsTo extends \Illuminate\Database\Eloquent\Relations\BelongsTo ...@@ -43,7 +43,7 @@ class BelongsTo extends \Illuminate\Database\Eloquent\Relations\BelongsTo
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
{ {
......
...@@ -21,7 +21,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -21,7 +21,7 @@ class BelongsToMany extends EloquentBelongsToMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
{ {
...@@ -29,7 +29,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -29,7 +29,7 @@ class BelongsToMany extends EloquentBelongsToMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function hydratePivotRelation(array $models) protected function hydratePivotRelation(array $models)
{ {
...@@ -47,7 +47,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -47,7 +47,7 @@ class BelongsToMany extends EloquentBelongsToMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function shouldSelect(array $columns = ['*']) protected function shouldSelect(array $columns = ['*'])
{ {
...@@ -55,7 +55,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -55,7 +55,7 @@ class BelongsToMany extends EloquentBelongsToMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function addConstraints() public function addConstraints()
{ {
...@@ -78,7 +78,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -78,7 +78,7 @@ class BelongsToMany extends EloquentBelongsToMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function save(Model $model, array $joining = [], $touch = true) public function save(Model $model, array $joining = [], $touch = true)
{ {
...@@ -90,7 +90,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -90,7 +90,7 @@ class BelongsToMany extends EloquentBelongsToMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function create(array $attributes = [], array $joining = [], $touch = true) public function create(array $attributes = [], array $joining = [], $touch = true)
{ {
...@@ -107,7 +107,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -107,7 +107,7 @@ class BelongsToMany extends EloquentBelongsToMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function sync($ids, $detaching = true) public function sync($ids, $detaching = true)
{ {
...@@ -167,7 +167,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -167,7 +167,7 @@ class BelongsToMany extends EloquentBelongsToMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function updateExistingPivot($id, array $attributes, $touch = true) public function updateExistingPivot($id, array $attributes, $touch = true)
{ {
...@@ -175,7 +175,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -175,7 +175,7 @@ class BelongsToMany extends EloquentBelongsToMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function attach($id, array $attributes = [], $touch = true) public function attach($id, array $attributes = [], $touch = true)
{ {
...@@ -208,7 +208,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -208,7 +208,7 @@ class BelongsToMany extends EloquentBelongsToMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function detach($ids = [], $touch = true) public function detach($ids = [], $touch = true)
{ {
...@@ -242,7 +242,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -242,7 +242,7 @@ class BelongsToMany extends EloquentBelongsToMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function buildDictionary(Collection $results) protected function buildDictionary(Collection $results)
{ {
...@@ -263,7 +263,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -263,7 +263,7 @@ class BelongsToMany extends EloquentBelongsToMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function newPivotQuery() public function newPivotQuery()
{ {
...@@ -289,7 +289,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -289,7 +289,7 @@ class BelongsToMany extends EloquentBelongsToMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getQualifiedForeignPivotKeyName() public function getQualifiedForeignPivotKeyName()
{ {
...@@ -297,7 +297,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -297,7 +297,7 @@ class BelongsToMany extends EloquentBelongsToMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getQualifiedRelatedPivotKeyName() public function getQualifiedRelatedPivotKeyName()
{ {
...@@ -306,7 +306,7 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -306,7 +306,7 @@ class BelongsToMany extends EloquentBelongsToMany
/** /**
* Format the sync list so that it is keyed by ID. (Legacy Support) * Format the sync list so that it is keyed by ID. (Legacy Support)
* The original function has been renamed to formatRecordsList since Laravel 5.3 * The original function has been renamed to formatRecordsList since Laravel 5.3.
* @param array $records * @param array $records
* @return array * @return array
* @deprecated * @deprecated
...@@ -315,11 +315,12 @@ class BelongsToMany extends EloquentBelongsToMany ...@@ -315,11 +315,12 @@ class BelongsToMany extends EloquentBelongsToMany
{ {
$results = []; $results = [];
foreach ($records as $id => $attributes) { foreach ($records as $id => $attributes) {
if (!is_array($attributes)) { if (! is_array($attributes)) {
list($id, $attributes) = [$attributes, []]; [$id, $attributes] = [$attributes, []];
} }
$results[$id] = $attributes; $results[$id] = $attributes;
} }
return $results; return $results;
} }
......
...@@ -36,7 +36,7 @@ class HasMany extends EloquentHasMany ...@@ -36,7 +36,7 @@ class HasMany extends EloquentHasMany
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
{ {
......
...@@ -36,7 +36,7 @@ class HasOne extends EloquentHasOne ...@@ -36,7 +36,7 @@ class HasOne extends EloquentHasOne
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*']) public function getRelationExistenceQuery(Builder $query, Builder $parentQuery, $columns = ['*'])
{ {
......
...@@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Relations\MorphTo as EloquentMorphTo; ...@@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Relations\MorphTo as EloquentMorphTo;
class MorphTo extends EloquentMorphTo class MorphTo extends EloquentMorphTo
{ {
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function addConstraints() public function addConstraints()
{ {
...@@ -21,7 +21,7 @@ class MorphTo extends EloquentMorphTo ...@@ -21,7 +21,7 @@ class MorphTo extends EloquentMorphTo
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function getResultsByType($type) protected function getResultsByType($type)
{ {
......
...@@ -25,7 +25,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint ...@@ -25,7 +25,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
protected $columns = []; protected $columns = [];
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function __construct(Connection $connection, $collection) public function __construct(Connection $connection, $collection)
{ {
...@@ -35,7 +35,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint ...@@ -35,7 +35,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function index($columns = null, $name = null, $algorithm = null, $options = []) public function index($columns = null, $name = null, $algorithm = null, $options = [])
{ {
...@@ -63,7 +63,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint ...@@ -63,7 +63,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function primary($columns = null, $name = null, $algorithm = null, $options = []) public function primary($columns = null, $name = null, $algorithm = null, $options = [])
{ {
...@@ -71,7 +71,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint ...@@ -71,7 +71,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function dropIndex($indexOrColumns = null) public function dropIndex($indexOrColumns = null)
{ {
...@@ -93,6 +93,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint ...@@ -93,6 +93,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
if ($this->hasIndex($indexOrColumns)) { if ($this->hasIndex($indexOrColumns)) {
$this->dropIndex($indexOrColumns); $this->dropIndex($indexOrColumns);
} }
return $this; return $this;
} }
...@@ -114,6 +115,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint ...@@ -114,6 +115,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
return true; return true;
} }
} }
return false; return false;
} }
...@@ -140,16 +142,17 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint ...@@ -140,16 +142,17 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
$sorting = $value; $sorting = $value;
} }
$transform[$column] = $column . "_" . $sorting; $transform[$column] = $column.'_'.$sorting;
} }
$indexOrColumns = implode('_', $transform); $indexOrColumns = implode('_', $transform);
} }
return $indexOrColumns; return $indexOrColumns;
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function unique($columns = null, $name = null, $algorithm = null, $options = []) public function unique($columns = null, $name = null, $algorithm = null, $options = [])
{ {
...@@ -249,7 +252,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint ...@@ -249,7 +252,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function drop() public function drop()
{ {
...@@ -257,7 +260,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint ...@@ -257,7 +260,7 @@ class Blueprint extends \Illuminate\Database\Schema\Blueprint
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function addColumn($type, $name, array $parameters = []) public function addColumn($type, $name, array $parameters = [])
{ {
......
...@@ -8,7 +8,7 @@ use Jenssegers\Mongodb\Connection; ...@@ -8,7 +8,7 @@ use Jenssegers\Mongodb\Connection;
class Builder extends \Illuminate\Database\Schema\Builder class Builder extends \Illuminate\Database\Schema\Builder
{ {
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function __construct(Connection $connection) public function __construct(Connection $connection)
{ {
...@@ -16,7 +16,7 @@ class Builder extends \Illuminate\Database\Schema\Builder ...@@ -16,7 +16,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function hasColumn($table, $column) public function hasColumn($table, $column)
{ {
...@@ -24,7 +24,7 @@ class Builder extends \Illuminate\Database\Schema\Builder ...@@ -24,7 +24,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function hasColumns($table, array $columns) public function hasColumns($table, array $columns)
{ {
...@@ -50,7 +50,7 @@ class Builder extends \Illuminate\Database\Schema\Builder ...@@ -50,7 +50,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function hasTable($collection) public function hasTable($collection)
{ {
...@@ -73,7 +73,7 @@ class Builder extends \Illuminate\Database\Schema\Builder ...@@ -73,7 +73,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function table($collection, Closure $callback) public function table($collection, Closure $callback)
{ {
...@@ -81,7 +81,7 @@ class Builder extends \Illuminate\Database\Schema\Builder ...@@ -81,7 +81,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function create($collection, Closure $callback = null, array $options = []) public function create($collection, Closure $callback = null, array $options = [])
{ {
...@@ -95,7 +95,7 @@ class Builder extends \Illuminate\Database\Schema\Builder ...@@ -95,7 +95,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function dropIfExists($collection) public function dropIfExists($collection)
{ {
...@@ -107,7 +107,7 @@ class Builder extends \Illuminate\Database\Schema\Builder ...@@ -107,7 +107,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function drop($collection) public function drop($collection)
{ {
...@@ -117,7 +117,7 @@ class Builder extends \Illuminate\Database\Schema\Builder ...@@ -117,7 +117,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
public function dropAllTables() public function dropAllTables()
{ {
...@@ -127,7 +127,7 @@ class Builder extends \Illuminate\Database\Schema\Builder ...@@ -127,7 +127,7 @@ class Builder extends \Illuminate\Database\Schema\Builder
} }
/** /**
* @inheritdoc * {@inheritdoc}
*/ */
protected function createBlueprint($collection, Closure $callback = null) protected function createBlueprint($collection, Closure $callback = null)
{ {
......
...@@ -40,7 +40,7 @@ class DatabasePresenceVerifier extends \Illuminate\Validation\DatabasePresenceVe ...@@ -40,7 +40,7 @@ class DatabasePresenceVerifier extends \Illuminate\Validation\DatabasePresenceVe
public function getMultiCount($collection, $column, array $values, array $extra = []) public function getMultiCount($collection, $column, array $values, array $extra = [])
{ {
// Generates a regex like '/(a|b|c)/i' which can query multiple values // Generates a regex like '/(a|b|c)/i' which can query multiple values
$regex = '/(' . implode('|', $values) . ')/i'; $regex = '/('.implode('|', $values).')/i';
$query = $this->table($collection)->where($column, 'regex', $regex); $query = $this->table($collection)->where($column, 'regex', $regex);
......
...@@ -29,6 +29,7 @@ class AuthTest extends TestCase ...@@ -29,6 +29,7 @@ class AuthTest extends TestCase
{ {
if (Application::VERSION >= '5.2') { if (Application::VERSION >= '5.2') {
$this->expectNotToPerformAssertions(); $this->expectNotToPerformAssertions();
return; return;
} }
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Jenssegers\Mongodb\Collection; use Jenssegers\Mongodb\Collection;
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
...@@ -97,7 +98,7 @@ class ConnectionTest extends TestCase ...@@ -97,7 +98,7 @@ class ConnectionTest extends TestCase
Config::set('database.connections.mongodb.options.database', 'custom'); Config::set('database.connections.mongodb.options.database', 'custom');
$connection = DB::connection('mongodb'); $connection = DB::connection('mongodb');
$this->assertEquals('mongodb://' . $host . '/custom', (string) $connection->getMongoClient()); $this->assertEquals('mongodb://'.$host.'/custom', (string) $connection->getMongoClient());
} }
public function testCustomHostAndPort() public function testCustomHostAndPort()
...@@ -106,7 +107,7 @@ class ConnectionTest extends TestCase ...@@ -106,7 +107,7 @@ class ConnectionTest extends TestCase
Config::set('database.connections.mongodb.port', 27000); Config::set('database.connections.mongodb.port', 27000);
$connection = DB::connection('mongodb'); $connection = DB::connection('mongodb');
$this->assertEquals("mongodb://db1:27000", (string) $connection->getMongoClient()); $this->assertEquals('mongodb://db1:27000', (string) $connection->getMongoClient());
} }
public function testHostWithPorts() public function testHostWithPorts()
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
class DsnTest extends TestCase class DsnTest extends TestCase
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
class GeospatialTest extends TestCase class GeospatialTest extends TestCase
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Database\MySqlConnection; use Illuminate\Database\MySqlConnection;
...@@ -28,7 +29,7 @@ class HybridRelationsTest extends TestCase ...@@ -28,7 +29,7 @@ class HybridRelationsTest extends TestCase
$this->assertInstanceOf(MySqlConnection::class, $user->getConnection()); $this->assertInstanceOf(MySqlConnection::class, $user->getConnection());
// Mysql User // Mysql User
$user->name = "John Doe"; $user->name = 'John Doe';
$user->save(); $user->save();
$this->assertIsInt($user->id); $this->assertIsInt($user->id);
...@@ -54,7 +55,7 @@ class HybridRelationsTest extends TestCase ...@@ -54,7 +55,7 @@ class HybridRelationsTest extends TestCase
// MongoDB User // MongoDB User
$user = new User; $user = new User;
$user->name = "John Doe"; $user->name = 'John Doe';
$user->save(); $user->save();
// MongoDB has many // MongoDB has many
...@@ -88,7 +89,7 @@ class HybridRelationsTest extends TestCase ...@@ -88,7 +89,7 @@ class HybridRelationsTest extends TestCase
$this->assertInstanceOf(MySqlConnection::class, $otherUser->getConnection()); $this->assertInstanceOf(MySqlConnection::class, $otherUser->getConnection());
//MySql User //MySql User
$user->name = "John Doe"; $user->name = 'John Doe';
$user->id = 2; $user->id = 2;
$user->save(); $user->save();
// Other user // Other user
...@@ -142,7 +143,7 @@ class HybridRelationsTest extends TestCase ...@@ -142,7 +143,7 @@ class HybridRelationsTest extends TestCase
$this->assertInstanceOf(MySqlConnection::class, $otherUser->getConnection()); $this->assertInstanceOf(MySqlConnection::class, $otherUser->getConnection());
//MySql User //MySql User
$user->name = "John Doe"; $user->name = 'John Doe';
$user->id = 2; $user->id = 2;
$user->save(); $user->save();
// Other user // Other user
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Carbon\Carbon; use Carbon\Carbon;
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Support\Facades\Date; use Illuminate\Support\Facades\Date;
...@@ -545,22 +546,22 @@ class QueryBuilderTest extends TestCase ...@@ -545,22 +546,22 @@ class QueryBuilderTest extends TestCase
public function testDates() public function testDates()
{ {
DB::collection('users')->insert([ DB::collection('users')->insert([
['name' => 'John Doe', 'birthday' => new UTCDateTime(Date::parse("1980-01-01 00:00:00")->format('Uv'))], ['name' => 'John Doe', 'birthday' => new UTCDateTime(Date::parse('1980-01-01 00:00:00')->format('Uv'))],
['name' => 'Jane Doe', 'birthday' => new UTCDateTime(Date::parse("1981-01-01 00:00:00")->format('Uv'))], ['name' => 'Jane Doe', 'birthday' => new UTCDateTime(Date::parse('1981-01-01 00:00:00')->format('Uv'))],
['name' => 'Robert Roe', 'birthday' => new UTCDateTime(Date::parse("1982-01-01 00:00:00")->format('Uv'))], ['name' => 'Robert Roe', 'birthday' => new UTCDateTime(Date::parse('1982-01-01 00:00:00')->format('Uv'))],
['name' => 'Mark Moe', 'birthday' => new UTCDateTime(Date::parse("1983-01-01 00:00:00")->format('Uv'))], ['name' => 'Mark Moe', 'birthday' => new UTCDateTime(Date::parse('1983-01-01 00:00:00')->format('Uv'))],
]); ]);
$user = DB::collection('users') $user = DB::collection('users')
->where('birthday', new UTCDateTime(Date::parse("1980-01-01 00:00:00")->format('Uv'))) ->where('birthday', new UTCDateTime(Date::parse('1980-01-01 00:00:00')->format('Uv')))
->first(); ->first();
$this->assertEquals('John Doe', $user['name']); $this->assertEquals('John Doe', $user['name']);
$user = DB::collection('users')->where('birthday', '=', new DateTime("1980-01-01 00:00:00"))->first(); $user = DB::collection('users')->where('birthday', '=', new DateTime('1980-01-01 00:00:00'))->first();
$this->assertEquals('John Doe', $user['name']); $this->assertEquals('John Doe', $user['name']);
$start = new UTCDateTime(1000 * strtotime("1981-01-01 00:00:00")); $start = new UTCDateTime(1000 * strtotime('1981-01-01 00:00:00'));
$stop = new UTCDateTime(1000 * strtotime("1982-01-01 00:00:00")); $stop = new UTCDateTime(1000 * strtotime('1982-01-01 00:00:00'));
$users = DB::collection('users')->whereBetween('birthday', [$start, $stop])->get(); $users = DB::collection('users')->whereBetween('birthday', [$start, $stop])->get();
$this->assertCount(2, $users); $this->assertCount(2, $users);
...@@ -623,11 +624,11 @@ class QueryBuilderTest extends TestCase ...@@ -623,11 +624,11 @@ class QueryBuilderTest extends TestCase
$results = DB::collection('items')->where('tags', 'size', 4)->get(); $results = DB::collection('items')->where('tags', 'size', 4)->get();
$this->assertCount(1, $results); $this->assertCount(1, $results);
$regex = new Regex(".*doe", "i"); $regex = new Regex('.*doe', 'i');
$results = DB::collection('users')->where('name', 'regex', $regex)->get(); $results = DB::collection('users')->where('name', 'regex', $regex)->get();
$this->assertCount(2, $results); $this->assertCount(2, $results);
$regex = new Regex(".*doe", "i"); $regex = new Regex('.*doe', 'i');
$results = DB::collection('users')->where('name', 'regexp', $regex)->get(); $results = DB::collection('users')->where('name', 'regexp', $regex)->get();
$this->assertCount(2, $results); $this->assertCount(2, $results);
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
class QueryTest extends TestCase class QueryTest extends TestCase
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Carbon\Carbon; use Carbon\Carbon;
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Jenssegers\Mongodb\Schema\Blueprint; use Jenssegers\Mongodb\Schema\Blueprint;
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
class SeederTest extends TestCase class SeederTest extends TestCase
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Auth\Passwords\PasswordResetServiceProvider; use Illuminate\Auth\Passwords\PasswordResetServiceProvider;
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
class ValidationTest extends TestCase class ValidationTest extends TestCase
......
...@@ -23,7 +23,7 @@ return [ ...@@ -23,7 +23,7 @@ return [
'dsn_mongodb_db' => [ 'dsn_mongodb_db' => [
'driver' => 'mongodb', 'driver' => 'mongodb',
'dsn' => "mongodb://$mongoHost:$mongoPort/" . env('MONGO_DATABASE', 'unittest'), 'dsn' => "mongodb://$mongoHost:$mongoPort/".env('MONGO_DATABASE', 'unittest'),
], ],
'mysql' => [ 'mysql' => [
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Jenssegers\Mongodb\Eloquent\Model as Eloquent; use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Jenssegers\Mongodb\Eloquent\Model as Eloquent; use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
/** /**
* Class Book * Class Book.
* @property string $title * @property string $title
* @property string $author * @property string $author
* @property array $chapters * @property array $chapters
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\BelongsToMany;
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\BelongsToMany;
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
...@@ -6,7 +7,7 @@ use Jenssegers\Mongodb\Eloquent\Builder; ...@@ -6,7 +7,7 @@ use Jenssegers\Mongodb\Eloquent\Builder;
use Jenssegers\Mongodb\Eloquent\Model as Eloquent; use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
/** /**
* Class Item * Class Item.
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
*/ */
class Item extends Eloquent class Item extends Eloquent
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Jenssegers\Mongodb\Eloquent\Model as Eloquent; use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
...@@ -28,7 +29,7 @@ class MysqlBook extends Eloquent ...@@ -28,7 +29,7 @@ class MysqlBook extends Eloquent
/** @var \Illuminate\Database\Schema\MySqlBuilder $schema */ /** @var \Illuminate\Database\Schema\MySqlBuilder $schema */
$schema = Schema::connection('mysql'); $schema = Schema::connection('mysql');
if (!$schema->hasTable('books')) { if (! $schema->hasTable('books')) {
Schema::connection('mysql')->create('books', function (Blueprint $table) { Schema::connection('mysql')->create('books', function (Blueprint $table) {
$table->string('title'); $table->string('title');
$table->string('author_id')->nullable(); $table->string('author_id')->nullable();
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
...@@ -32,7 +33,7 @@ class MysqlRole extends Eloquent ...@@ -32,7 +33,7 @@ class MysqlRole extends Eloquent
/** @var \Illuminate\Database\Schema\MySqlBuilder $schema */ /** @var \Illuminate\Database\Schema\MySqlBuilder $schema */
$schema = Schema::connection('mysql'); $schema = Schema::connection('mysql');
if (!$schema->hasTable('roles')) { if (! $schema->hasTable('roles')) {
Schema::connection('mysql')->create('roles', function (Blueprint $table) { Schema::connection('mysql')->create('roles', function (Blueprint $table) {
$table->string('type'); $table->string('type');
$table->string('user_id'); $table->string('user_id');
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
...@@ -38,7 +39,7 @@ class MysqlUser extends Eloquent ...@@ -38,7 +39,7 @@ class MysqlUser extends Eloquent
/** @var \Illuminate\Database\Schema\MySqlBuilder $schema */ /** @var \Illuminate\Database\Schema\MySqlBuilder $schema */
$schema = Schema::connection('mysql'); $schema = Schema::connection('mysql');
if (!$schema->hasTable('users')) { if (! $schema->hasTable('users')) {
Schema::connection('mysql')->create('users', function (Blueprint $table) { Schema::connection('mysql')->create('users', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->string('name'); $table->string('name');
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\Relations\MorphTo;
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Jenssegers\Mongodb\Eloquent\Builder; use Jenssegers\Mongodb\Eloquent\Builder;
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Jenssegers\Mongodb\Eloquent\Model as Eloquent; use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
use Jenssegers\Mongodb\Eloquent\SoftDeletes; use Jenssegers\Mongodb\Eloquent\SoftDeletes;
/** /**
* Class Soft * Class Soft.
* @property \Carbon\Carbon $deleted_at * @property \Carbon\Carbon $deleted_at
*/ */
class Soft extends Eloquent class Soft extends Eloquent
......
<?php <?php
declare(strict_types=1); declare(strict_types=1);
use Illuminate\Auth\Authenticatable; use Illuminate\Auth\Authenticatable;
...@@ -10,7 +11,7 @@ use Jenssegers\Mongodb\Eloquent\HybridRelations; ...@@ -10,7 +11,7 @@ use Jenssegers\Mongodb\Eloquent\HybridRelations;
use Jenssegers\Mongodb\Eloquent\Model as Eloquent; use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
/** /**
* Class User * Class User.
* @property string $_id * @property string $_id
* @property string $name * @property string $name
* @property string $title * @property string $title
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment