mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 11:41:31 +00:00
updated streamline-setup v2
This commit is contained in:
docker/streamline-src/vendor/laravel/framework/src/Illuminate/Auth/Access/AuthorizationException.php
Vendored
+1
-1
@@ -29,7 +29,7 @@ class AuthorizationException extends Exception
|
||||
* @param \Throwable|null $previous
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($message = null, $code = null, Throwable $previous = null)
|
||||
public function __construct($message = null, $code = null, ?Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message ?? 'This action is unauthorized.', 0, $previous);
|
||||
|
||||
|
||||
+2
-2
@@ -100,7 +100,7 @@ class Gate implements GateContract
|
||||
array $policies = [],
|
||||
array $beforeCallbacks = [],
|
||||
array $afterCallbacks = [],
|
||||
callable $guessPolicyNamesUsingCallback = null)
|
||||
?callable $guessPolicyNamesUsingCallback = null)
|
||||
{
|
||||
$this->policies = $policies;
|
||||
$this->container = $container;
|
||||
@@ -224,7 +224,7 @@ class Gate implements GateContract
|
||||
* @param array|null $abilities
|
||||
* @return $this
|
||||
*/
|
||||
public function resource($name, $class, array $abilities = null)
|
||||
public function resource($name, $class, ?array $abilities = null)
|
||||
{
|
||||
$abilities = $abilities ?: [
|
||||
'viewAny' => 'viewAny',
|
||||
|
||||
Vendored
+1
-1
@@ -45,7 +45,7 @@ class PasswordBroker implements PasswordBrokerContract
|
||||
* @param \Closure|null $callback
|
||||
* @return string
|
||||
*/
|
||||
public function sendResetLink(array $credentials, Closure $callback = null)
|
||||
public function sendResetLink(array $credentials, ?Closure $callback = null)
|
||||
{
|
||||
// First we will check to see if we found a user at the given credentials and
|
||||
// if we did not we will redirect back to this current URI with a piece of
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ class RequestGuard implements Guard
|
||||
* @param \Illuminate\Contracts\Auth\UserProvider|null $provider
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(callable $callback, Request $request, UserProvider $provider = null)
|
||||
public function __construct(callable $callback, Request $request, ?UserProvider $provider = null)
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->callback = $callback;
|
||||
|
||||
+2
-2
@@ -123,8 +123,8 @@ class SessionGuard implements StatefulGuard, SupportsBasicAuth
|
||||
public function __construct($name,
|
||||
UserProvider $provider,
|
||||
Session $session,
|
||||
Request $request = null,
|
||||
Timebox $timebox = null)
|
||||
?Request $request = null,
|
||||
?Timebox $timebox = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->session = $session;
|
||||
|
||||
Vendored
+14
-3
@@ -64,7 +64,7 @@ class BroadcastManager implements FactoryContract
|
||||
* @param array|null $attributes
|
||||
* @return void
|
||||
*/
|
||||
public function routes(array $attributes = null)
|
||||
public function routes(?array $attributes = null)
|
||||
{
|
||||
if ($this->app instanceof CachesRoutes && $this->app->routesAreCached()) {
|
||||
return;
|
||||
@@ -86,7 +86,7 @@ class BroadcastManager implements FactoryContract
|
||||
* @param array|null $attributes
|
||||
* @return void
|
||||
*/
|
||||
public function userRoutes(array $attributes = null)
|
||||
public function userRoutes(?array $attributes = null)
|
||||
{
|
||||
if ($this->app instanceof CachesRoutes && $this->app->routesAreCached()) {
|
||||
return;
|
||||
@@ -110,7 +110,7 @@ class BroadcastManager implements FactoryContract
|
||||
* @param array|null $attributes
|
||||
* @return void
|
||||
*/
|
||||
public function channelRoutes(array $attributes = null)
|
||||
public function channelRoutes(?array $attributes = null)
|
||||
{
|
||||
$this->routes($attributes);
|
||||
}
|
||||
@@ -273,6 +273,17 @@ class BroadcastManager implements FactoryContract
|
||||
return $this->customCreators[$config['driver']]($this->app, $config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Illuminate\Contracts\Broadcasting\Broadcaster
|
||||
*/
|
||||
protected function createReverbDriver(array $config)
|
||||
{
|
||||
return $this->createPusherDriver($config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the driver.
|
||||
*
|
||||
|
||||
+1
-1
@@ -450,7 +450,7 @@ class Batch implements Arrayable, JsonSerializable
|
||||
* @param \Throwable|null $e
|
||||
* @return void
|
||||
*/
|
||||
protected function invokeHandlerCallback($handler, Batch $batch, Throwable $e = null)
|
||||
protected function invokeHandlerCallback($handler, Batch $batch, ?Throwable $e = null)
|
||||
{
|
||||
try {
|
||||
return $handler($batch, $e);
|
||||
|
||||
Vendored
+2
-2
@@ -6,10 +6,10 @@ use Carbon\CarbonImmutable;
|
||||
use Closure;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Connection;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Database\PostgresConnection;
|
||||
use Illuminate\Database\Query\Expression;
|
||||
use Illuminate\Support\Str;
|
||||
use Throwable;
|
||||
|
||||
class DatabaseBatchRepository implements PrunableBatchRepository
|
||||
{
|
||||
@@ -352,7 +352,7 @@ class DatabaseBatchRepository implements PrunableBatchRepository
|
||||
|
||||
try {
|
||||
return unserialize($serialized);
|
||||
} catch (ModelNotFoundException) {
|
||||
} catch (Throwable) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ class Dispatcher implements QueueingDispatcher
|
||||
* @param \Closure|null $queueResolver
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Container $container, Closure $queueResolver = null)
|
||||
public function __construct(Container $container, ?Closure $queueResolver = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->queueResolver = $queueResolver;
|
||||
|
||||
+10
@@ -199,6 +199,11 @@ trait Queueable
|
||||
*/
|
||||
public function prependToChain($job)
|
||||
{
|
||||
$job = match (true) {
|
||||
$job instanceof PendingBatch => new ChainedBatch($job),
|
||||
default => $job,
|
||||
};
|
||||
|
||||
$this->chained = Arr::prepend($this->chained, $this->serializeJob($job));
|
||||
|
||||
return $this;
|
||||
@@ -212,6 +217,11 @@ trait Queueable
|
||||
*/
|
||||
public function appendToChain($job)
|
||||
{
|
||||
$job = match (true) {
|
||||
$job instanceof PendingBatch => new ChainedBatch($job),
|
||||
default => $job,
|
||||
};
|
||||
|
||||
$this->chained = array_merge($this->chained, [$this->serializeJob($job)]);
|
||||
|
||||
return $this;
|
||||
|
||||
+1
-3
@@ -158,9 +158,7 @@ class DatabaseStore implements LockProvider, Store
|
||||
$value = $this->serialize($value);
|
||||
$expiration = $this->getTime() + $seconds;
|
||||
|
||||
$doesntSupportInsertOrIgnore = [SqlServerConnection::class];
|
||||
|
||||
if (! in_array(get_class($this->getConnection()), $doesntSupportInsertOrIgnore)) {
|
||||
if (! $this->getConnection() instanceof SqlServerConnection) {
|
||||
return $this->table()->insertOrIgnore(compact('key', 'value', 'expiration')) > 0;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ class RedisTagSet extends TagSet
|
||||
* @param string $updateWhen
|
||||
* @return void
|
||||
*/
|
||||
public function addEntry(string $key, int $ttl = null, $updateWhen = null)
|
||||
public function addEntry(string $key, ?int $ttl = null, $updateWhen = null)
|
||||
{
|
||||
$ttl = is_null($ttl) ? -1 : Carbon::now()->addSeconds($ttl)->getTimestamp();
|
||||
|
||||
|
||||
+10
-14
@@ -19,16 +19,14 @@ class RedisTaggedCache extends TaggedCache
|
||||
if ($ttl !== null) {
|
||||
$seconds = $this->getSeconds($ttl);
|
||||
|
||||
if ($seconds <= 0) {
|
||||
return false;
|
||||
if ($seconds > 0) {
|
||||
$this->tags->addEntry(
|
||||
$this->itemKey($key),
|
||||
$seconds
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$this->tags->addEntry(
|
||||
$this->itemKey($key),
|
||||
$seconds
|
||||
);
|
||||
|
||||
return parent::add($key, $value, $ttl);
|
||||
}
|
||||
|
||||
@@ -48,15 +46,13 @@ class RedisTaggedCache extends TaggedCache
|
||||
|
||||
$seconds = $this->getSeconds($ttl);
|
||||
|
||||
if ($seconds <= 0) {
|
||||
return false;
|
||||
if ($seconds > 0) {
|
||||
$this->tags->addEntry(
|
||||
$this->itemKey($key),
|
||||
$seconds
|
||||
);
|
||||
}
|
||||
|
||||
$this->tags->addEntry(
|
||||
$this->itemKey($key),
|
||||
$seconds
|
||||
);
|
||||
|
||||
return parent::put($key, $value, $ttl);
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -22,8 +22,7 @@ use Illuminate\Support\Traits\Macroable;
|
||||
*/
|
||||
class Repository implements ArrayAccess, CacheContract
|
||||
{
|
||||
use InteractsWithTime;
|
||||
use Macroable {
|
||||
use InteractsWithTime, Macroable {
|
||||
__call as macroCall;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -185,7 +185,7 @@ class Arr
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function first($array, callable $callback = null, $default = null)
|
||||
public static function first($array, ?callable $callback = null, $default = null)
|
||||
{
|
||||
if (is_null($callback)) {
|
||||
if (empty($array)) {
|
||||
@@ -216,7 +216,7 @@ class Arr
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function last($array, callable $callback = null, $default = null)
|
||||
public static function last($array, ?callable $callback = null, $default = null)
|
||||
{
|
||||
if (is_null($callback)) {
|
||||
return empty($array) ? value($default) : end($array);
|
||||
|
||||
+50
-11
@@ -7,6 +7,7 @@ use ArrayIterator;
|
||||
use Illuminate\Contracts\Support\CanBeEscapedWhenCastToString;
|
||||
use Illuminate\Support\Traits\EnumeratesValues;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use InvalidArgumentException;
|
||||
use stdClass;
|
||||
use Traversable;
|
||||
|
||||
@@ -381,7 +382,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
* @param (callable(TValue, TKey): bool)|null $callback
|
||||
* @return static
|
||||
*/
|
||||
public function filter(callable $callback = null)
|
||||
public function filter(?callable $callback = null)
|
||||
{
|
||||
if ($callback) {
|
||||
return new static(Arr::where($this->items, $callback));
|
||||
@@ -399,7 +400,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
* @param TFirstDefault|(\Closure(): TFirstDefault) $default
|
||||
* @return TValue|TFirstDefault
|
||||
*/
|
||||
public function first(callable $callback = null, $default = null)
|
||||
public function first(?callable $callback = null, $default = null)
|
||||
{
|
||||
return Arr::first($this->items, $callback, $default);
|
||||
}
|
||||
@@ -747,7 +748,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
* @param TLastDefault|(\Closure(): TLastDefault) $default
|
||||
* @return TValue|TLastDefault
|
||||
*/
|
||||
public function last(callable $callback = null, $default = null)
|
||||
public function last(?callable $callback = null, $default = null)
|
||||
{
|
||||
return Arr::last($this->items, $callback, $default);
|
||||
}
|
||||
@@ -998,8 +999,11 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
/**
|
||||
* Push all of the given items onto the collection.
|
||||
*
|
||||
* @param iterable<array-key, TValue> $source
|
||||
* @return static
|
||||
* @template TConcatKey of array-key
|
||||
* @template TConcatValue
|
||||
*
|
||||
* @param iterable<TConcatKey, TConcatValue> $source
|
||||
* @return static<TKey|TConcatKey, TValue|TConcatValue>
|
||||
*/
|
||||
public function concat($source)
|
||||
{
|
||||
@@ -1121,17 +1125,27 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
*
|
||||
* @param int $count
|
||||
* @return static<int, TValue>|TValue|null
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function shift($count = 1)
|
||||
{
|
||||
if ($count === 1) {
|
||||
return array_shift($this->items);
|
||||
if ($count < 0) {
|
||||
throw new InvalidArgumentException('Number of shifted items may not be less than zero.');
|
||||
}
|
||||
|
||||
if ($this->isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($count === 0) {
|
||||
return new static;
|
||||
}
|
||||
|
||||
if ($count === 1) {
|
||||
return array_shift($this->items);
|
||||
}
|
||||
|
||||
$results = [];
|
||||
|
||||
$collectionCount = $this->count();
|
||||
@@ -1397,7 +1411,7 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
public function sortBy($callback, $options = SORT_REGULAR, $descending = false)
|
||||
{
|
||||
if (is_array($callback) && ! is_callable($callback)) {
|
||||
return $this->sortByMany($callback);
|
||||
return $this->sortByMany($callback, $options);
|
||||
}
|
||||
|
||||
$results = [];
|
||||
@@ -1428,13 +1442,14 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
* Sort the collection using multiple comparisons.
|
||||
*
|
||||
* @param array<array-key, (callable(TValue, TValue): mixed)|(callable(TValue, TKey): mixed)|string|array{string, string}> $comparisons
|
||||
* @param int $options
|
||||
* @return static
|
||||
*/
|
||||
protected function sortByMany(array $comparisons = [])
|
||||
protected function sortByMany(array $comparisons = [], int $options = SORT_REGULAR)
|
||||
{
|
||||
$items = $this->items;
|
||||
|
||||
uasort($items, function ($a, $b) use ($comparisons) {
|
||||
uasort($items, function ($a, $b) use ($comparisons, $options) {
|
||||
foreach ($comparisons as $comparison) {
|
||||
$comparison = Arr::wrap($comparison);
|
||||
|
||||
@@ -1452,7 +1467,21 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
$values = array_reverse($values);
|
||||
}
|
||||
|
||||
$result = $values[0] <=> $values[1];
|
||||
if (($options & SORT_FLAG_CASE) === SORT_FLAG_CASE) {
|
||||
if (($options & SORT_NATURAL) === SORT_NATURAL) {
|
||||
$result = strnatcasecmp($values[0], $values[1]);
|
||||
} else {
|
||||
$result = strcasecmp($values[0], $values[1]);
|
||||
}
|
||||
} else {
|
||||
$result = match ($options) {
|
||||
SORT_NUMERIC => intval($values[0]) <=> intval($values[1]),
|
||||
SORT_STRING => strcmp($values[0], $values[1]),
|
||||
SORT_NATURAL => strnatcmp($values[0], $values[1]),
|
||||
SORT_LOCALE_STRING => strcoll($values[0], $values[1]),
|
||||
default => $values[0] <=> $values[1],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if ($result === 0) {
|
||||
@@ -1475,6 +1504,16 @@ class Collection implements ArrayAccess, CanBeEscapedWhenCastToString, Enumerabl
|
||||
*/
|
||||
public function sortByDesc($callback, $options = SORT_REGULAR)
|
||||
{
|
||||
if (is_array($callback) && ! is_callable($callback)) {
|
||||
foreach ($callback as $index => $key) {
|
||||
$comparison = Arr::wrap($key);
|
||||
|
||||
$comparison[1] = 'desc';
|
||||
|
||||
$callback[$index] = $comparison;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->sortBy($callback, $options, true);
|
||||
}
|
||||
|
||||
|
||||
+15
-12
@@ -38,7 +38,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
|
||||
* @param callable|null $callback
|
||||
* @return static
|
||||
*/
|
||||
public static function times($number, callable $callback = null);
|
||||
public static function times($number, ?callable $callback = null);
|
||||
|
||||
/**
|
||||
* Create a collection with the given range.
|
||||
@@ -296,7 +296,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
|
||||
* @param (callable(TValue): bool)|null $callback
|
||||
* @return static
|
||||
*/
|
||||
public function filter(callable $callback = null);
|
||||
public function filter(?callable $callback = null);
|
||||
|
||||
/**
|
||||
* Apply the callback if the given "value" is (or resolves to) truthy.
|
||||
@@ -308,7 +308,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
|
||||
* @param (callable($this): TWhenReturnType)|null $default
|
||||
* @return $this|TWhenReturnType
|
||||
*/
|
||||
public function when($value, callable $callback = null, callable $default = null);
|
||||
public function when($value, ?callable $callback = null, ?callable $default = null);
|
||||
|
||||
/**
|
||||
* Apply the callback if the collection is empty.
|
||||
@@ -319,7 +319,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
|
||||
* @param (callable($this): TWhenEmptyReturnType)|null $default
|
||||
* @return $this|TWhenEmptyReturnType
|
||||
*/
|
||||
public function whenEmpty(callable $callback, callable $default = null);
|
||||
public function whenEmpty(callable $callback, ?callable $default = null);
|
||||
|
||||
/**
|
||||
* Apply the callback if the collection is not empty.
|
||||
@@ -330,7 +330,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
|
||||
* @param (callable($this): TWhenNotEmptyReturnType)|null $default
|
||||
* @return $this|TWhenNotEmptyReturnType
|
||||
*/
|
||||
public function whenNotEmpty(callable $callback, callable $default = null);
|
||||
public function whenNotEmpty(callable $callback, ?callable $default = null);
|
||||
|
||||
/**
|
||||
* Apply the callback if the given "value" is (or resolves to) truthy.
|
||||
@@ -342,7 +342,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
|
||||
* @param (callable($this): TUnlessReturnType)|null $default
|
||||
* @return $this|TUnlessReturnType
|
||||
*/
|
||||
public function unless($value, callable $callback, callable $default = null);
|
||||
public function unless($value, callable $callback, ?callable $default = null);
|
||||
|
||||
/**
|
||||
* Apply the callback unless the collection is empty.
|
||||
@@ -353,7 +353,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
|
||||
* @param (callable($this): TUnlessEmptyReturnType)|null $default
|
||||
* @return $this|TUnlessEmptyReturnType
|
||||
*/
|
||||
public function unlessEmpty(callable $callback, callable $default = null);
|
||||
public function unlessEmpty(callable $callback, ?callable $default = null);
|
||||
|
||||
/**
|
||||
* Apply the callback unless the collection is not empty.
|
||||
@@ -364,7 +364,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
|
||||
* @param (callable($this): TUnlessNotEmptyReturnType)|null $default
|
||||
* @return $this|TUnlessNotEmptyReturnType
|
||||
*/
|
||||
public function unlessNotEmpty(callable $callback, callable $default = null);
|
||||
public function unlessNotEmpty(callable $callback, ?callable $default = null);
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair.
|
||||
@@ -476,7 +476,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
|
||||
* @param TFirstDefault|(\Closure(): TFirstDefault) $default
|
||||
* @return TValue|TFirstDefault
|
||||
*/
|
||||
public function first(callable $callback = null, $default = null);
|
||||
public function first(?callable $callback = null, $default = null);
|
||||
|
||||
/**
|
||||
* Get the first item by the given key value pair.
|
||||
@@ -618,7 +618,7 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
|
||||
* @param TLastDefault|(\Closure(): TLastDefault) $default
|
||||
* @return TValue|TLastDefault
|
||||
*/
|
||||
public function last(callable $callback = null, $default = null);
|
||||
public function last(?callable $callback = null, $default = null);
|
||||
|
||||
/**
|
||||
* Run a map over each of the items.
|
||||
@@ -789,8 +789,11 @@ interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable,
|
||||
/**
|
||||
* Push all of the given items onto the collection.
|
||||
*
|
||||
* @param iterable<array-key, TValue> $source
|
||||
* @return static
|
||||
* @template TConcatKey of array-key
|
||||
* @template TConcatValue
|
||||
*
|
||||
* @param iterable<TConcatKey, TConcatValue> $source
|
||||
* @return static<TKey|TConcatKey, TValue|TConcatValue>
|
||||
*/
|
||||
public function concat($source);
|
||||
|
||||
|
||||
Vendored
+8
-5
@@ -428,7 +428,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
* @param (callable(TValue, TKey): bool)|null $callback
|
||||
* @return static
|
||||
*/
|
||||
public function filter(callable $callback = null)
|
||||
public function filter(?callable $callback = null)
|
||||
{
|
||||
if (is_null($callback)) {
|
||||
$callback = fn ($value) => (bool) $value;
|
||||
@@ -452,7 +452,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
* @param TFirstDefault|(\Closure(): TFirstDefault) $default
|
||||
* @return TValue|TFirstDefault
|
||||
*/
|
||||
public function first(callable $callback = null, $default = null)
|
||||
public function first(?callable $callback = null, $default = null)
|
||||
{
|
||||
$iterator = $this->getIterator();
|
||||
|
||||
@@ -732,7 +732,7 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
* @param TLastDefault|(\Closure(): TLastDefault) $default
|
||||
* @return TValue|TLastDefault
|
||||
*/
|
||||
public function last(callable $callback = null, $default = null)
|
||||
public function last(?callable $callback = null, $default = null)
|
||||
{
|
||||
$needle = $placeholder = new stdClass;
|
||||
|
||||
@@ -991,8 +991,11 @@ class LazyCollection implements CanBeEscapedWhenCastToString, Enumerable
|
||||
/**
|
||||
* Push all of the given items onto the collection.
|
||||
*
|
||||
* @param iterable<array-key, TValue> $source
|
||||
* @return static
|
||||
* @template TConcatKey of array-key
|
||||
* @template TConcatValue
|
||||
*
|
||||
* @param iterable<TConcatKey, TConcatValue> $source
|
||||
* @return static<TKey|TConcatKey, TValue|TConcatValue>
|
||||
*/
|
||||
public function concat($source)
|
||||
{
|
||||
|
||||
+5
-5
@@ -164,7 +164,7 @@ trait EnumeratesValues
|
||||
* @param (callable(int): TTimesValue)|null $callback
|
||||
* @return static<int, TTimesValue>
|
||||
*/
|
||||
public static function times($number, callable $callback = null)
|
||||
public static function times($number, ?callable $callback = null)
|
||||
{
|
||||
if ($number < 1) {
|
||||
return new static;
|
||||
@@ -534,7 +534,7 @@ trait EnumeratesValues
|
||||
* @param (callable($this): TWhenEmptyReturnType)|null $default
|
||||
* @return $this|TWhenEmptyReturnType
|
||||
*/
|
||||
public function whenEmpty(callable $callback, callable $default = null)
|
||||
public function whenEmpty(callable $callback, ?callable $default = null)
|
||||
{
|
||||
return $this->when($this->isEmpty(), $callback, $default);
|
||||
}
|
||||
@@ -548,7 +548,7 @@ trait EnumeratesValues
|
||||
* @param (callable($this): TWhenNotEmptyReturnType)|null $default
|
||||
* @return $this|TWhenNotEmptyReturnType
|
||||
*/
|
||||
public function whenNotEmpty(callable $callback, callable $default = null)
|
||||
public function whenNotEmpty(callable $callback, ?callable $default = null)
|
||||
{
|
||||
return $this->when($this->isNotEmpty(), $callback, $default);
|
||||
}
|
||||
@@ -562,7 +562,7 @@ trait EnumeratesValues
|
||||
* @param (callable($this): TUnlessEmptyReturnType)|null $default
|
||||
* @return $this|TUnlessEmptyReturnType
|
||||
*/
|
||||
public function unlessEmpty(callable $callback, callable $default = null)
|
||||
public function unlessEmpty(callable $callback, ?callable $default = null)
|
||||
{
|
||||
return $this->whenNotEmpty($callback, $default);
|
||||
}
|
||||
@@ -576,7 +576,7 @@ trait EnumeratesValues
|
||||
* @param (callable($this): TUnlessNotEmptyReturnType)|null $default
|
||||
* @return $this|TUnlessNotEmptyReturnType
|
||||
*/
|
||||
public function unlessNotEmpty(callable $callback, callable $default = null)
|
||||
public function unlessNotEmpty(callable $callback, ?callable $default = null)
|
||||
{
|
||||
return $this->whenEmpty($callback, $default);
|
||||
}
|
||||
|
||||
docker/streamline-src/vendor/laravel/framework/src/Illuminate/Conditionable/Traits/Conditionable.php
Vendored
+2
-2
@@ -18,7 +18,7 @@ trait Conditionable
|
||||
* @param (callable($this, TWhenParameter): TWhenReturnType)|null $default
|
||||
* @return $this|TWhenReturnType
|
||||
*/
|
||||
public function when($value = null, callable $callback = null, callable $default = null)
|
||||
public function when($value = null, ?callable $callback = null, ?callable $default = null)
|
||||
{
|
||||
$value = $value instanceof Closure ? $value($this) : $value;
|
||||
|
||||
@@ -50,7 +50,7 @@ trait Conditionable
|
||||
* @param (callable($this, TUnlessParameter): TUnlessReturnType)|null $default
|
||||
* @return $this|TUnlessReturnType
|
||||
*/
|
||||
public function unless($value = null, callable $callback = null, callable $default = null)
|
||||
public function unless($value = null, ?callable $callback = null, ?callable $default = null)
|
||||
{
|
||||
$value = $value instanceof Closure ? $value($this) : $value;
|
||||
|
||||
|
||||
+3
-1
@@ -237,7 +237,9 @@ class Application extends SymfonyApplication implements ApplicationContract
|
||||
public function resolve($command)
|
||||
{
|
||||
if (is_subclass_of($command, SymfonyCommand::class) && ($commandName = $command::getDefaultName())) {
|
||||
$this->commandMap[$commandName] = $command;
|
||||
foreach (explode('|', $commandName) as $name) {
|
||||
$this->commandMap[$name] = $command;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
+6
-4
@@ -236,11 +236,13 @@ class Command extends SymfonyCommand
|
||||
*/
|
||||
protected function resolveCommand($command)
|
||||
{
|
||||
if (! class_exists($command)) {
|
||||
return $this->getApplication()->find($command);
|
||||
}
|
||||
if (is_string($command)) {
|
||||
if (! class_exists($command)) {
|
||||
return $this->getApplication()->find($command);
|
||||
}
|
||||
|
||||
$command = $this->laravel->make($command);
|
||||
$command = $this->laravel->make($command);
|
||||
}
|
||||
|
||||
if ($command instanceof SymfonyCommand) {
|
||||
$command->setApplication($this->getApplication());
|
||||
|
||||
+1
-1
@@ -271,7 +271,7 @@ class ScheduleRunCommand extends Command
|
||||
/**
|
||||
* Ensure the interrupt signal is cleared.
|
||||
*
|
||||
* @return bool
|
||||
* @return void
|
||||
*/
|
||||
protected function clearInterruptSignal()
|
||||
{
|
||||
|
||||
+4
-4
@@ -1148,7 +1148,7 @@ class Container implements ArrayAccess, ContainerContract
|
||||
* @param \Closure|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function beforeResolving($abstract, Closure $callback = null)
|
||||
public function beforeResolving($abstract, ?Closure $callback = null)
|
||||
{
|
||||
if (is_string($abstract)) {
|
||||
$abstract = $this->getAlias($abstract);
|
||||
@@ -1168,7 +1168,7 @@ class Container implements ArrayAccess, ContainerContract
|
||||
* @param \Closure|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function resolving($abstract, Closure $callback = null)
|
||||
public function resolving($abstract, ?Closure $callback = null)
|
||||
{
|
||||
if (is_string($abstract)) {
|
||||
$abstract = $this->getAlias($abstract);
|
||||
@@ -1188,7 +1188,7 @@ class Container implements ArrayAccess, ContainerContract
|
||||
* @param \Closure|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function afterResolving($abstract, Closure $callback = null)
|
||||
public function afterResolving($abstract, ?Closure $callback = null)
|
||||
{
|
||||
if (is_string($abstract)) {
|
||||
$abstract = $this->getAlias($abstract);
|
||||
@@ -1427,7 +1427,7 @@ class Container implements ArrayAccess, ContainerContract
|
||||
* @param \Illuminate\Contracts\Container\Container|null $container
|
||||
* @return \Illuminate\Contracts\Container\Container|static
|
||||
*/
|
||||
public static function setInstance(ContainerContract $container = null)
|
||||
public static function setInstance(?ContainerContract $container = null)
|
||||
{
|
||||
return static::$instance = $container;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -29,7 +29,7 @@ interface Gate
|
||||
* @param array|null $abilities
|
||||
* @return $this
|
||||
*/
|
||||
public function resource($name, $class, array $abilities = null);
|
||||
public function resource($name, $class, ?array $abilities = null);
|
||||
|
||||
/**
|
||||
* Define a policy class for a given class type.
|
||||
|
||||
Vendored
+1
-1
@@ -48,7 +48,7 @@ interface PasswordBroker
|
||||
* @param \Closure|null $callback
|
||||
* @return string
|
||||
*/
|
||||
public function sendResetLink(array $credentials, Closure $callback = null);
|
||||
public function sendResetLink(array $credentials, ?Closure $callback = null);
|
||||
|
||||
/**
|
||||
* Reset the password for the given token.
|
||||
|
||||
Vendored
+3
-3
@@ -197,7 +197,7 @@ interface Container extends ContainerInterface
|
||||
* @param \Closure|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function beforeResolving($abstract, Closure $callback = null);
|
||||
public function beforeResolving($abstract, ?Closure $callback = null);
|
||||
|
||||
/**
|
||||
* Register a new resolving callback.
|
||||
@@ -206,7 +206,7 @@ interface Container extends ContainerInterface
|
||||
* @param \Closure|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function resolving($abstract, Closure $callback = null);
|
||||
public function resolving($abstract, ?Closure $callback = null);
|
||||
|
||||
/**
|
||||
* Register a new after resolving callback.
|
||||
@@ -215,5 +215,5 @@ interface Container extends ContainerInterface
|
||||
* @param \Closure|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function afterResolving($abstract, Closure $callback = null);
|
||||
public function afterResolving($abstract, ?Closure $callback = null);
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -60,5 +60,5 @@ interface InvokedProcess
|
||||
* @param callable|null $output
|
||||
* @return \Illuminate\Console\Process\ProcessResult
|
||||
*/
|
||||
public function wait(callable $output = null);
|
||||
public function wait(?callable $output = null);
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -52,7 +52,7 @@ interface ProcessResult
|
||||
* @param callable|null $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function throw(callable $callback = null);
|
||||
public function throw(?callable $callback = null);
|
||||
|
||||
/**
|
||||
* Throw an exception if the process failed and the given condition is true.
|
||||
@@ -61,5 +61,5 @@ interface ProcessResult
|
||||
* @param callable|null $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function throwIf(bool $condition, callable $callback = null);
|
||||
public function throwIf(bool $condition, ?callable $callback = null);
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ class Manager
|
||||
* @param \Illuminate\Container\Container|null $container
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Container $container = null)
|
||||
public function __construct(?Container $container = null)
|
||||
{
|
||||
$this->setupContainer($container ?: new Container);
|
||||
|
||||
|
||||
Vendored
+20
-13
@@ -379,11 +379,14 @@ trait BuildsQueries
|
||||
$orders = $this->ensureOrderForCursorPagination(! is_null($cursor) && $cursor->pointsToPreviousItems());
|
||||
|
||||
if (! is_null($cursor)) {
|
||||
$addCursorConditions = function (self $builder, $previousColumn, $i) use (&$addCursorConditions, $cursor, $orders) {
|
||||
$unionBuilders = isset($builder->unions) ? collect($builder->unions)->pluck('query') : collect();
|
||||
// Reset the union bindings so we can add the cursor where in the correct position...
|
||||
$this->setBindings([], 'union');
|
||||
|
||||
$addCursorConditions = function (self $builder, $previousColumn, $originalColumn, $i) use (&$addCursorConditions, $cursor, $orders) {
|
||||
$unionBuilders = $builder->getUnionBuilders();
|
||||
|
||||
if (! is_null($previousColumn)) {
|
||||
$originalColumn = $this->getOriginalColumnNameForCursorPagination($this, $previousColumn);
|
||||
$originalColumn ??= $this->getOriginalColumnNameForCursorPagination($this, $previousColumn);
|
||||
|
||||
$builder->where(
|
||||
Str::contains($originalColumn, ['(', ')']) ? new Expression($originalColumn) : $originalColumn,
|
||||
@@ -393,7 +396,7 @@ trait BuildsQueries
|
||||
|
||||
$unionBuilders->each(function ($unionBuilder) use ($previousColumn, $cursor) {
|
||||
$unionBuilder->where(
|
||||
$this->getOriginalColumnNameForCursorPagination($this, $previousColumn),
|
||||
$this->getOriginalColumnNameForCursorPagination($unionBuilder, $previousColumn),
|
||||
'=',
|
||||
$cursor->parameter($previousColumn)
|
||||
);
|
||||
@@ -402,44 +405,48 @@ trait BuildsQueries
|
||||
});
|
||||
}
|
||||
|
||||
$builder->where(function (self $builder) use ($addCursorConditions, $cursor, $orders, $i, $unionBuilders) {
|
||||
$builder->where(function (self $secondBuilder) use ($addCursorConditions, $cursor, $orders, $i, $unionBuilders) {
|
||||
['column' => $column, 'direction' => $direction] = $orders[$i];
|
||||
|
||||
$originalColumn = $this->getOriginalColumnNameForCursorPagination($this, $column);
|
||||
|
||||
$builder->where(
|
||||
$secondBuilder->where(
|
||||
Str::contains($originalColumn, ['(', ')']) ? new Expression($originalColumn) : $originalColumn,
|
||||
$direction === 'asc' ? '>' : '<',
|
||||
$cursor->parameter($column)
|
||||
);
|
||||
|
||||
if ($i < $orders->count() - 1) {
|
||||
$builder->orWhere(function (self $builder) use ($addCursorConditions, $column, $i) {
|
||||
$addCursorConditions($builder, $column, $i + 1);
|
||||
$secondBuilder->orWhere(function (self $thirdBuilder) use ($addCursorConditions, $column, $originalColumn, $i) {
|
||||
$addCursorConditions($thirdBuilder, $column, $originalColumn, $i + 1);
|
||||
});
|
||||
}
|
||||
|
||||
$unionBuilders->each(function ($unionBuilder) use ($column, $direction, $cursor, $i, $orders, $addCursorConditions) {
|
||||
$unionBuilder->where(function ($unionBuilder) use ($column, $direction, $cursor, $i, $orders, $addCursorConditions) {
|
||||
$unionWheres = $unionBuilder->getRawBindings()['where'];
|
||||
|
||||
$originalColumn = $this->getOriginalColumnNameForCursorPagination($unionBuilder, $column);
|
||||
$unionBuilder->where(function ($unionBuilder) use ($column, $direction, $cursor, $i, $orders, $addCursorConditions, $originalColumn, $unionWheres) {
|
||||
$unionBuilder->where(
|
||||
$this->getOriginalColumnNameForCursorPagination($this, $column),
|
||||
$originalColumn,
|
||||
$direction === 'asc' ? '>' : '<',
|
||||
$cursor->parameter($column)
|
||||
);
|
||||
|
||||
if ($i < $orders->count() - 1) {
|
||||
$unionBuilder->orWhere(function (self $builder) use ($addCursorConditions, $column, $i) {
|
||||
$addCursorConditions($builder, $column, $i + 1);
|
||||
$unionBuilder->orWhere(function (self $fourthBuilder) use ($addCursorConditions, $column, $originalColumn, $i) {
|
||||
$addCursorConditions($fourthBuilder, $column, $originalColumn, $i + 1);
|
||||
});
|
||||
}
|
||||
|
||||
$this->addBinding($unionWheres, 'union');
|
||||
$this->addBinding($unionBuilder->getRawBindings()['where'], 'union');
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$addCursorConditions($this, null, 0);
|
||||
$addCursorConditions($this, null, null, 0);
|
||||
}
|
||||
|
||||
$this->limit($perPage + 1);
|
||||
|
||||
+9
-10
@@ -41,22 +41,15 @@ trait ManagesTransactions
|
||||
continue;
|
||||
}
|
||||
|
||||
$levelBeingCommitted = $this->transactions;
|
||||
|
||||
try {
|
||||
if ($this->transactions == 1) {
|
||||
$this->fireConnectionEvent('committing');
|
||||
$this->getPdo()->commit();
|
||||
}
|
||||
|
||||
[$levelBeingCommitted, $this->transactions] = [
|
||||
$this->transactions,
|
||||
max(0, $this->transactions - 1),
|
||||
];
|
||||
|
||||
$this->transactionsManager?->commit(
|
||||
$this->getName(),
|
||||
$levelBeingCommitted,
|
||||
$this->transactions
|
||||
);
|
||||
$this->transactions = max(0, $this->transactions - 1);
|
||||
} catch (Throwable $e) {
|
||||
$this->handleCommitTransactionException(
|
||||
$e, $currentAttempt, $attempts
|
||||
@@ -65,6 +58,12 @@ trait ManagesTransactions
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->transactionsManager?->commit(
|
||||
$this->getName(),
|
||||
$levelBeingCommitted,
|
||||
$this->transactions
|
||||
);
|
||||
|
||||
$this->fireConnectionEvent('committed');
|
||||
|
||||
return $callbackResult;
|
||||
|
||||
+11
-39
@@ -38,8 +38,6 @@ class PostgresConnector extends Connector implements ConnectorInterface
|
||||
|
||||
$this->configureIsolationLevel($connection, $config);
|
||||
|
||||
$this->configureEncoding($connection, $config);
|
||||
|
||||
// Next, we will check to see if a timezone has been specified in this config
|
||||
// and if it has we will issue a statement to modify the timezone with the
|
||||
// database. Setting this DB timezone is an optional configuration item.
|
||||
@@ -47,11 +45,6 @@ class PostgresConnector extends Connector implements ConnectorInterface
|
||||
|
||||
$this->configureSearchPath($connection, $config);
|
||||
|
||||
// Postgres allows an application_name to be set by the user and this name is
|
||||
// used to when monitoring the application with pg_stat_activity. So we'll
|
||||
// determine if the option has been specified and run a statement if so.
|
||||
$this->configureApplicationName($connection, $config);
|
||||
|
||||
$this->configureSynchronousCommit($connection, $config);
|
||||
|
||||
return $connection;
|
||||
@@ -71,22 +64,6 @@ class PostgresConnector extends Connector implements ConnectorInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the connection character set and collation.
|
||||
*
|
||||
* @param \PDO $connection
|
||||
* @param array $config
|
||||
* @return void
|
||||
*/
|
||||
protected function configureEncoding($connection, $config)
|
||||
{
|
||||
if (! isset($config['charset'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$connection->prepare("set names '{$config['charset']}'")->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the timezone on the connection.
|
||||
*
|
||||
@@ -132,22 +109,6 @@ class PostgresConnector extends Connector implements ConnectorInterface
|
||||
return count($searchPath) === 1 ? '"'.$searchPath[0].'"' : '"'.implode('", "', $searchPath).'"';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the application name on the connection.
|
||||
*
|
||||
* @param \PDO $connection
|
||||
* @param array $config
|
||||
* @return void
|
||||
*/
|
||||
protected function configureApplicationName($connection, $config)
|
||||
{
|
||||
if (isset($config['application_name'])) {
|
||||
$applicationName = $config['application_name'];
|
||||
|
||||
$connection->prepare("set application_name to '$applicationName'")->execute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a DSN string from a configuration.
|
||||
*
|
||||
@@ -178,6 +139,17 @@ class PostgresConnector extends Connector implements ConnectorInterface
|
||||
$dsn .= ";port={$port}";
|
||||
}
|
||||
|
||||
if (isset($charset)) {
|
||||
$dsn .= ";client_encoding='{$charset}'";
|
||||
}
|
||||
|
||||
// Postgres allows an application_name to be set by the user and this name is
|
||||
// used to when monitoring the application with pg_stat_activity. So we'll
|
||||
// determine if the option has been specified and run a statement if so.
|
||||
if (isset($application_name)) {
|
||||
$dsn .= ";application_name='".str_replace("'", "\'", $application_name)."'";
|
||||
}
|
||||
|
||||
return $this->addSslOptions($dsn, $config);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ abstract class DatabaseInspectionCommand extends Command
|
||||
* @param \Illuminate\Support\Composer|null $composer
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Composer $composer = null)
|
||||
public function __construct(?Composer $composer = null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
Vendored
+8
-2
@@ -4,14 +4,17 @@ namespace Illuminate\Database\DBAL;
|
||||
|
||||
use Doctrine\DBAL\Exception as DBALException;
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Platforms\MariaDb1010Platform;
|
||||
use Doctrine\DBAL\Platforms\MariaDb1027Platform;
|
||||
use Doctrine\DBAL\Platforms\MariaDb1052Platform;
|
||||
use Doctrine\DBAL\Platforms\MariaDb1060Platform;
|
||||
use Doctrine\DBAL\Platforms\MariaDBPlatform;
|
||||
use Doctrine\DBAL\Platforms\MySQL57Platform;
|
||||
use Doctrine\DBAL\Platforms\MySQL80Platform;
|
||||
use Doctrine\DBAL\Platforms\MySQL84Platform;
|
||||
use Doctrine\DBAL\Platforms\MySQLPlatform;
|
||||
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
|
||||
use Doctrine\DBAL\Platforms\PostgreSQL120Platform;
|
||||
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
|
||||
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
|
||||
use Doctrine\DBAL\Platforms\SqlitePlatform;
|
||||
@@ -33,13 +36,16 @@ class TimestampType extends Type implements PhpDateTimeMappingType
|
||||
MySQLPlatform::class,
|
||||
MySQL57Platform::class,
|
||||
MySQL80Platform::class,
|
||||
MySQL84Platform::class,
|
||||
MariaDBPlatform::class,
|
||||
MariaDb1027Platform::class,
|
||||
MariaDb1052Platform::class,
|
||||
MariaDb1060Platform::class => $this->getMySqlPlatformSQLDeclaration($column),
|
||||
MariaDb1060Platform::class,
|
||||
MariaDb1010Platform::class => $this->getMySqlPlatformSQLDeclaration($column),
|
||||
PostgreSQLPlatform::class,
|
||||
PostgreSQL94Platform::class,
|
||||
PostgreSQL100Platform::class => $this->getPostgresPlatformSQLDeclaration($column),
|
||||
PostgreSQL100Platform::class,
|
||||
PostgreSQL120Platform::class => $this->getPostgresPlatformSQLDeclaration($column),
|
||||
SQLServerPlatform::class,
|
||||
SQLServer2012Platform::class => $this->getSqlServerPlatformSQLDeclaration($column),
|
||||
SqlitePlatform::class => 'DATETIME',
|
||||
|
||||
Vendored
+2
@@ -19,6 +19,7 @@ trait DetectsLostConnections
|
||||
|
||||
return Str::contains($message, [
|
||||
'server has gone away',
|
||||
'Server has gone away',
|
||||
'no connection to the server',
|
||||
'Lost connection',
|
||||
'is dead or not enabled',
|
||||
@@ -71,6 +72,7 @@ trait DetectsLostConnections
|
||||
'SQLSTATE[HY000] [2002] The requested address is not valid in its context',
|
||||
'SQLSTATE[HY000] [2002] A socket operation was attempted to an unreachable network',
|
||||
'SQLSTATE[HY000]: General error: 3989',
|
||||
'went away',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+16
-3
@@ -108,6 +108,7 @@ class Builder implements BuilderContract
|
||||
'getbindings',
|
||||
'getconnection',
|
||||
'getgrammar',
|
||||
'getrawbindings',
|
||||
'implode',
|
||||
'insert',
|
||||
'insertgetid',
|
||||
@@ -202,7 +203,7 @@ class Builder implements BuilderContract
|
||||
* @param array|null $scopes
|
||||
* @return $this
|
||||
*/
|
||||
public function withoutGlobalScopes(array $scopes = null)
|
||||
public function withoutGlobalScopes(?array $scopes = null)
|
||||
{
|
||||
if (! is_array($scopes)) {
|
||||
$scopes = array_keys($this->scopes);
|
||||
@@ -524,7 +525,7 @@ class Builder implements BuilderContract
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|mixed
|
||||
*/
|
||||
public function findOr($id, $columns = ['*'], Closure $callback = null)
|
||||
public function findOr($id, $columns = ['*'], ?Closure $callback = null)
|
||||
{
|
||||
if ($columns instanceof Closure) {
|
||||
$callback = $columns;
|
||||
@@ -627,7 +628,7 @@ class Builder implements BuilderContract
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Model|static|mixed
|
||||
*/
|
||||
public function firstOr($columns = ['*'], Closure $callback = null)
|
||||
public function firstOr($columns = ['*'], ?Closure $callback = null)
|
||||
{
|
||||
if ($columns instanceof Closure) {
|
||||
$callback = $columns;
|
||||
@@ -1727,6 +1728,18 @@ class Builder implements BuilderContract
|
||||
: $scope();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Eloquent builder instances that are used in the union of the query.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
protected function getUnionBuilders()
|
||||
{
|
||||
return isset($this->query->unions)
|
||||
? collect($this->query->unions)->pluck('query')
|
||||
: collect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying query builder instance.
|
||||
*
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ class AsEnumArrayObject implements Castable
|
||||
|
||||
public function get($model, $key, $value, $attributes)
|
||||
{
|
||||
if (! isset($attributes[$key]) || is_null($attributes[$key])) {
|
||||
if (! isset($attributes[$key])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ class AsEnumCollection implements Castable
|
||||
|
||||
public function get($model, $key, $value, $attributes)
|
||||
{
|
||||
if (! isset($attributes[$key]) || is_null($attributes[$key])) {
|
||||
if (! isset($attributes[$key])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -39,7 +39,7 @@ class Attribute
|
||||
* @param callable|null $set
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(callable $get = null, callable $set = null)
|
||||
public function __construct(?callable $get = null, ?callable $set = null)
|
||||
{
|
||||
$this->get = $get;
|
||||
$this->set = $set;
|
||||
@@ -52,7 +52,7 @@ class Attribute
|
||||
* @param callable|null $set
|
||||
* @return static
|
||||
*/
|
||||
public static function make(callable $get = null, callable $set = null): static
|
||||
public static function make(?callable $get = null, ?callable $set = null): static
|
||||
{
|
||||
return new static($get, $set);
|
||||
}
|
||||
|
||||
+5
-1
@@ -1271,7 +1271,11 @@ trait HasAttributes
|
||||
*/
|
||||
public function fromJson($value, $asObject = false)
|
||||
{
|
||||
return Json::decode($value ?? '', ! $asObject);
|
||||
if ($value === null || $value === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return Json::decode($value, ! $asObject);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+13
-13
@@ -29,7 +29,7 @@ trait QueriesRelationships
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', Closure $callback = null)
|
||||
public function has($relation, $operator = '>=', $count = 1, $boolean = 'and', ?Closure $callback = null)
|
||||
{
|
||||
if (is_string($relation)) {
|
||||
if (str_contains($relation, '.')) {
|
||||
@@ -122,7 +122,7 @@ trait QueriesRelationships
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function doesntHave($relation, $boolean = 'and', Closure $callback = null)
|
||||
public function doesntHave($relation, $boolean = 'and', ?Closure $callback = null)
|
||||
{
|
||||
return $this->has($relation, '<', 1, $boolean, $callback);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ trait QueriesRelationships
|
||||
* @param int $count
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function whereHas($relation, Closure $callback = null, $operator = '>=', $count = 1)
|
||||
public function whereHas($relation, ?Closure $callback = null, $operator = '>=', $count = 1)
|
||||
{
|
||||
return $this->has($relation, $operator, $count, 'and', $callback);
|
||||
}
|
||||
@@ -163,7 +163,7 @@ trait QueriesRelationships
|
||||
* @param int $count
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function withWhereHas($relation, Closure $callback = null, $operator = '>=', $count = 1)
|
||||
public function withWhereHas($relation, ?Closure $callback = null, $operator = '>=', $count = 1)
|
||||
{
|
||||
return $this->whereHas(Str::before($relation, ':'), $callback, $operator, $count)
|
||||
->with($callback ? [$relation => fn ($query) => $callback($query)] : $relation);
|
||||
@@ -178,7 +178,7 @@ trait QueriesRelationships
|
||||
* @param int $count
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function orWhereHas($relation, Closure $callback = null, $operator = '>=', $count = 1)
|
||||
public function orWhereHas($relation, ?Closure $callback = null, $operator = '>=', $count = 1)
|
||||
{
|
||||
return $this->has($relation, $operator, $count, 'or', $callback);
|
||||
}
|
||||
@@ -190,7 +190,7 @@ trait QueriesRelationships
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function whereDoesntHave($relation, Closure $callback = null)
|
||||
public function whereDoesntHave($relation, ?Closure $callback = null)
|
||||
{
|
||||
return $this->doesntHave($relation, 'and', $callback);
|
||||
}
|
||||
@@ -202,7 +202,7 @@ trait QueriesRelationships
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function orWhereDoesntHave($relation, Closure $callback = null)
|
||||
public function orWhereDoesntHave($relation, ?Closure $callback = null)
|
||||
{
|
||||
return $this->doesntHave($relation, 'or', $callback);
|
||||
}
|
||||
@@ -218,7 +218,7 @@ trait QueriesRelationships
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function hasMorph($relation, $types, $operator = '>=', $count = 1, $boolean = 'and', Closure $callback = null)
|
||||
public function hasMorph($relation, $types, $operator = '>=', $count = 1, $boolean = 'and', ?Closure $callback = null)
|
||||
{
|
||||
if (is_string($relation)) {
|
||||
$relation = $this->getRelationWithoutConstraints($relation);
|
||||
@@ -301,7 +301,7 @@ trait QueriesRelationships
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function doesntHaveMorph($relation, $types, $boolean = 'and', Closure $callback = null)
|
||||
public function doesntHaveMorph($relation, $types, $boolean = 'and', ?Closure $callback = null)
|
||||
{
|
||||
return $this->hasMorph($relation, $types, '<', 1, $boolean, $callback);
|
||||
}
|
||||
@@ -328,7 +328,7 @@ trait QueriesRelationships
|
||||
* @param int $count
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function whereHasMorph($relation, $types, Closure $callback = null, $operator = '>=', $count = 1)
|
||||
public function whereHasMorph($relation, $types, ?Closure $callback = null, $operator = '>=', $count = 1)
|
||||
{
|
||||
return $this->hasMorph($relation, $types, $operator, $count, 'and', $callback);
|
||||
}
|
||||
@@ -343,7 +343,7 @@ trait QueriesRelationships
|
||||
* @param int $count
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function orWhereHasMorph($relation, $types, Closure $callback = null, $operator = '>=', $count = 1)
|
||||
public function orWhereHasMorph($relation, $types, ?Closure $callback = null, $operator = '>=', $count = 1)
|
||||
{
|
||||
return $this->hasMorph($relation, $types, $operator, $count, 'or', $callback);
|
||||
}
|
||||
@@ -356,7 +356,7 @@ trait QueriesRelationships
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function whereDoesntHaveMorph($relation, $types, Closure $callback = null)
|
||||
public function whereDoesntHaveMorph($relation, $types, ?Closure $callback = null)
|
||||
{
|
||||
return $this->doesntHaveMorph($relation, $types, 'and', $callback);
|
||||
}
|
||||
@@ -369,7 +369,7 @@ trait QueriesRelationships
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Builder|static
|
||||
*/
|
||||
public function orWhereDoesntHaveMorph($relation, $types, Closure $callback = null)
|
||||
public function orWhereDoesntHaveMorph($relation, $types, ?Closure $callback = null)
|
||||
{
|
||||
return $this->doesntHaveMorph($relation, $types, 'or', $callback);
|
||||
}
|
||||
|
||||
+1
-1
@@ -676,7 +676,7 @@ abstract class Factory
|
||||
/**
|
||||
* Add a new "after creating" callback to the model definition.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Database\Eloquent\Model|TModel): mixed $callback
|
||||
* @param \Closure(\Illuminate\Database\Eloquent\Model|TModel, \Illuminate\Database\Eloquent\Model|null): mixed $callback
|
||||
* @return static
|
||||
*/
|
||||
public function afterCreating(Closure $callback)
|
||||
|
||||
+8
-7
@@ -20,6 +20,7 @@ use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection as BaseCollection;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Traits\ForwardsCalls;
|
||||
use JsonException;
|
||||
use JsonSerializable;
|
||||
use LogicException;
|
||||
|
||||
@@ -1646,10 +1647,10 @@ abstract class Model implements Arrayable, ArrayAccess, CanBeEscapedWhenCastToSt
|
||||
*/
|
||||
public function toJson($options = 0)
|
||||
{
|
||||
$json = json_encode($this->jsonSerialize(), $options);
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
throw JsonEncodingException::forModel($this, json_last_error_msg());
|
||||
try {
|
||||
$json = json_encode($this->jsonSerialize(), $options | JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException $e) {
|
||||
throw JsonEncodingException::forModel($this, $e->getMessage());
|
||||
}
|
||||
|
||||
return $json;
|
||||
@@ -1717,7 +1718,7 @@ abstract class Model implements Arrayable, ArrayAccess, CanBeEscapedWhenCastToSt
|
||||
* @param array|null $except
|
||||
* @return static
|
||||
*/
|
||||
public function replicate(array $except = null)
|
||||
public function replicate(?array $except = null)
|
||||
{
|
||||
$defaults = array_values(array_filter([
|
||||
$this->getKeyName(),
|
||||
@@ -1745,7 +1746,7 @@ abstract class Model implements Arrayable, ArrayAccess, CanBeEscapedWhenCastToSt
|
||||
* @param array|null $except
|
||||
* @return static
|
||||
*/
|
||||
public function replicateQuietly(array $except = null)
|
||||
public function replicateQuietly(?array $except = null)
|
||||
{
|
||||
return static::withoutEvents(fn () => $this->replicate($except));
|
||||
}
|
||||
@@ -2122,7 +2123,7 @@ abstract class Model implements Arrayable, ArrayAccess, CanBeEscapedWhenCastToSt
|
||||
/**
|
||||
* Retrieve the model for a bound value.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Relations\Relation $query
|
||||
* @param \Illuminate\Database\Eloquent\Model|\Illuminate\Contracts\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Relations\Relation $query
|
||||
* @param mixed $value
|
||||
* @param string|null $field
|
||||
* @return \Illuminate\Database\Eloquent\Relations\Relation
|
||||
|
||||
+4
-1
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Illuminate\Database\Eloquent\Relations;
|
||||
|
||||
use BackedEnum;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -375,7 +376,9 @@ class BelongsTo extends Relation
|
||||
*/
|
||||
protected function getForeignKeyFrom(Model $model)
|
||||
{
|
||||
return $model->{$this->foreignKey};
|
||||
$foreignKey = $model->{$this->foreignKey};
|
||||
|
||||
return $foreignKey instanceof BackedEnum ? $foreignKey->value : $foreignKey;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+76
-6
@@ -753,7 +753,7 @@ class BelongsToMany extends Relation
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|mixed
|
||||
*/
|
||||
public function findOr($id, $columns = ['*'], Closure $callback = null)
|
||||
public function findOr($id, $columns = ['*'], ?Closure $callback = null)
|
||||
{
|
||||
if ($columns instanceof Closure) {
|
||||
$callback = $columns;
|
||||
@@ -827,7 +827,7 @@ class BelongsToMany extends Relation
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Model|static|mixed
|
||||
*/
|
||||
public function firstOr($columns = ['*'], Closure $callback = null)
|
||||
public function firstOr($columns = ['*'], ?Closure $callback = null)
|
||||
{
|
||||
if ($columns instanceof Closure) {
|
||||
$callback = $columns;
|
||||
@@ -997,19 +997,66 @@ class BelongsToMany extends Relation
|
||||
*/
|
||||
public function chunkById($count, callable $callback, $column = null, $alias = null)
|
||||
{
|
||||
$this->prepareQueryBuilder();
|
||||
return $this->orderedChunkById($count, $callback, $column, $alias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Chunk the results of a query by comparing IDs in descending order.
|
||||
*
|
||||
* @param int $count
|
||||
* @param callable $callback
|
||||
* @param string|null $column
|
||||
* @param string|null $alias
|
||||
* @return bool
|
||||
*/
|
||||
public function chunkByIdDesc($count, callable $callback, $column = null, $alias = null)
|
||||
{
|
||||
return $this->orderedChunkById($count, $callback, $column, $alias, descending: true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a callback over each item while chunking by ID.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param int $count
|
||||
* @param string|null $column
|
||||
* @param string|null $alias
|
||||
* @return bool
|
||||
*/
|
||||
public function eachById(callable $callback, $count = 1000, $column = null, $alias = null)
|
||||
{
|
||||
return $this->chunkById($count, function ($results, $page) use ($callback, $count) {
|
||||
foreach ($results as $key => $value) {
|
||||
if ($callback($value, (($page - 1) * $count) + $key) === false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}, $column, $alias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Chunk the results of a query by comparing IDs in a given order.
|
||||
*
|
||||
* @param int $count
|
||||
* @param callable $callback
|
||||
* @param string|null $column
|
||||
* @param string|null $alias
|
||||
* @param bool $descending
|
||||
* @return bool
|
||||
*/
|
||||
public function orderedChunkById($count, callable $callback, $column = null, $alias = null, $descending = false)
|
||||
{
|
||||
$column ??= $this->getRelated()->qualifyColumn(
|
||||
$this->getRelatedKeyName()
|
||||
);
|
||||
|
||||
$alias ??= $this->getRelatedKeyName();
|
||||
|
||||
return $this->query->chunkById($count, function ($results) use ($callback) {
|
||||
return $this->prepareQueryBuilder()->orderedChunkById($count, function ($results, $page) use ($callback) {
|
||||
$this->hydratePivotRelation($results->all());
|
||||
|
||||
return $callback($results);
|
||||
}, $column, $alias);
|
||||
return $callback($results, $page);
|
||||
}, $column, $alias, $descending);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1068,6 +1115,29 @@ class BelongsToMany extends Relation
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Query lazily, by chunking the results of a query by comparing IDs in descending order.
|
||||
*
|
||||
* @param int $chunkSize
|
||||
* @param string|null $column
|
||||
* @param string|null $alias
|
||||
* @return \Illuminate\Support\LazyCollection
|
||||
*/
|
||||
public function lazyByIdDesc($chunkSize = 1000, $column = null, $alias = null)
|
||||
{
|
||||
$column ??= $this->getRelated()->qualifyColumn(
|
||||
$this->getRelatedKeyName()
|
||||
);
|
||||
|
||||
$alias ??= $this->getRelatedKeyName();
|
||||
|
||||
return $this->prepareQueryBuilder()->lazyByIdDesc($chunkSize, $column, $alias)->map(function ($model) {
|
||||
$this->hydratePivotRelation([$model]);
|
||||
|
||||
return $model;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a lazy collection for the given query.
|
||||
*
|
||||
|
||||
+5
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Illuminate\Database\Eloquent\Relations\Concerns;
|
||||
|
||||
use BackedEnum;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
@@ -154,6 +155,10 @@ trait InteractsWithPivotTable
|
||||
[$id, $attributes] = [$attributes, []];
|
||||
}
|
||||
|
||||
if ($id instanceof BackedEnum) {
|
||||
$id = $id->value;
|
||||
}
|
||||
|
||||
return [$id => $attributes];
|
||||
})->all();
|
||||
}
|
||||
|
||||
+38
-3
@@ -122,7 +122,7 @@ class HasManyThrough extends Relation
|
||||
* @param \Illuminate\Database\Eloquent\Builder|null $query
|
||||
* @return void
|
||||
*/
|
||||
protected function performJoin(Builder $query = null)
|
||||
protected function performJoin(?Builder $query = null)
|
||||
{
|
||||
$query = $query ?: $this->query;
|
||||
|
||||
@@ -363,7 +363,7 @@ class HasManyThrough extends Relation
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Model|static|mixed
|
||||
*/
|
||||
public function firstOr($columns = ['*'], Closure $callback = null)
|
||||
public function firstOr($columns = ['*'], ?Closure $callback = null)
|
||||
{
|
||||
if ($columns instanceof Closure) {
|
||||
$callback = $columns;
|
||||
@@ -450,7 +450,7 @@ class HasManyThrough extends Relation
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|mixed
|
||||
*/
|
||||
public function findOr($id, $columns = ['*'], Closure $callback = null)
|
||||
public function findOr($id, $columns = ['*'], ?Closure $callback = null)
|
||||
{
|
||||
if ($columns instanceof Closure) {
|
||||
$callback = $columns;
|
||||
@@ -600,6 +600,24 @@ class HasManyThrough extends Relation
|
||||
return $this->prepareQueryBuilder()->chunkById($count, $callback, $column, $alias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Chunk the results of a query by comparing IDs in descending order.
|
||||
*
|
||||
* @param int $count
|
||||
* @param callable $callback
|
||||
* @param string|null $column
|
||||
* @param string|null $alias
|
||||
* @return bool
|
||||
*/
|
||||
public function chunkByIdDesc($count, callable $callback, $column = null, $alias = null)
|
||||
{
|
||||
$column ??= $this->getRelated()->getQualifiedKeyName();
|
||||
|
||||
$alias ??= $this->getRelated()->getKeyName();
|
||||
|
||||
return $this->prepareQueryBuilder()->chunkByIdDesc($count, $callback, $column, $alias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a callback over each item while chunking by ID.
|
||||
*
|
||||
@@ -674,6 +692,23 @@ class HasManyThrough extends Relation
|
||||
return $this->prepareQueryBuilder()->lazyById($chunkSize, $column, $alias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query lazily, by chunking the results of a query by comparing IDs in descending order.
|
||||
*
|
||||
* @param int $chunkSize
|
||||
* @param string|null $column
|
||||
* @param string|null $alias
|
||||
* @return \Illuminate\Support\LazyCollection
|
||||
*/
|
||||
public function lazyByIdDesc($chunkSize = 1000, $column = null, $alias = null)
|
||||
{
|
||||
$column ??= $this->getRelated()->getQualifiedKeyName();
|
||||
|
||||
$alias ??= $this->getRelated()->getKeyName();
|
||||
|
||||
return $this->prepareQueryBuilder()->lazyByIdDesc($chunkSize, $column, $alias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the query builder for query execution.
|
||||
*
|
||||
|
||||
+2
-2
@@ -461,7 +461,7 @@ abstract class Relation implements BuilderContract
|
||||
* @param bool $merge
|
||||
* @return array
|
||||
*/
|
||||
public static function morphMap(array $map = null, $merge = true)
|
||||
public static function morphMap(?array $map = null, $merge = true)
|
||||
{
|
||||
$map = static::buildMorphMapFromModels($map);
|
||||
|
||||
@@ -479,7 +479,7 @@ abstract class Relation implements BuilderContract
|
||||
* @param string[]|null $models
|
||||
* @return array|null
|
||||
*/
|
||||
protected static function buildMorphMapFromModels(array $models = null)
|
||||
protected static function buildMorphMapFromModels(?array $models = null)
|
||||
{
|
||||
if (is_null($models) || ! array_is_list($models)) {
|
||||
return $models;
|
||||
|
||||
Vendored
+1
-1
@@ -92,7 +92,7 @@ class Migrator
|
||||
public function __construct(MigrationRepositoryInterface $repository,
|
||||
Resolver $resolver,
|
||||
Filesystem $files,
|
||||
Dispatcher $dispatcher = null)
|
||||
?Dispatcher $dispatcher = null)
|
||||
{
|
||||
$this->files = $files;
|
||||
$this->events = $dispatcher;
|
||||
|
||||
+47
-1
@@ -14,6 +14,42 @@ use PDO;
|
||||
|
||||
class MySqlConnection extends Connection
|
||||
{
|
||||
/**
|
||||
* The last inserted ID generated by the server.
|
||||
*
|
||||
* @var string|int|null
|
||||
*/
|
||||
protected $lastInsertId;
|
||||
|
||||
/**
|
||||
* Run an insert statement against the database.
|
||||
*
|
||||
* @param string $query
|
||||
* @param array $bindings
|
||||
* @param string|null $sequence
|
||||
* @return bool
|
||||
*/
|
||||
public function insert($query, $bindings = [], $sequence = null)
|
||||
{
|
||||
return $this->run($query, $bindings, function ($query, $bindings) use ($sequence) {
|
||||
if ($this->pretending()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$statement = $this->getPdo()->prepare($query);
|
||||
|
||||
$this->bindValues($statement, $this->prepareBindings($bindings));
|
||||
|
||||
$this->recordsHaveBeenModified();
|
||||
|
||||
$result = $statement->execute();
|
||||
|
||||
$this->lastInsertId = $this->getPdo()->lastInsertId($sequence);
|
||||
|
||||
return $result;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape a binary value for safe SQL embedding.
|
||||
*
|
||||
@@ -38,6 +74,16 @@ class MySqlConnection extends Connection
|
||||
return boolval(preg_match('#Integrity constraint violation: 1062#i', $exception->getMessage()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the connection's last insert ID.
|
||||
*
|
||||
* @return string|int|null
|
||||
*/
|
||||
public function getLastInsertId()
|
||||
{
|
||||
return $this->lastInsertId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the connected database is a MariaDB database.
|
||||
*
|
||||
@@ -93,7 +139,7 @@ class MySqlConnection extends Connection
|
||||
* @param callable|null $processFactory
|
||||
* @return \Illuminate\Database\Schema\MySqlSchemaState
|
||||
*/
|
||||
public function getSchemaState(Filesystem $files = null, callable $processFactory = null)
|
||||
public function getSchemaState(?Filesystem $files = null, ?callable $processFactory = null)
|
||||
{
|
||||
return new MySqlSchemaState($this, $files, $processFactory);
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -93,7 +93,7 @@ class PostgresConnection extends Connection
|
||||
* @param callable|null $processFactory
|
||||
* @return \Illuminate\Database\Schema\PostgresSchemaState
|
||||
*/
|
||||
public function getSchemaState(Filesystem $files = null, callable $processFactory = null)
|
||||
public function getSchemaState(?Filesystem $files = null, ?callable $processFactory = null)
|
||||
{
|
||||
return new PostgresSchemaState($this, $files, $processFactory);
|
||||
}
|
||||
|
||||
+147
-19
@@ -98,7 +98,7 @@ class Builder implements BuilderContract
|
||||
/**
|
||||
* The table which the query is targeting.
|
||||
*
|
||||
* @var string
|
||||
* @var \Illuminate\Database\Query\Expression|string
|
||||
*/
|
||||
public $from;
|
||||
|
||||
@@ -239,8 +239,8 @@ class Builder implements BuilderContract
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ConnectionInterface $connection,
|
||||
Grammar $grammar = null,
|
||||
Processor $processor = null)
|
||||
?Grammar $grammar = null,
|
||||
?Processor $processor = null)
|
||||
{
|
||||
$this->connection = $connection;
|
||||
$this->grammar = $grammar ?: $connection->getQueryGrammar();
|
||||
@@ -510,7 +510,7 @@ class Builder implements BuilderContract
|
||||
* Add a join clause to the query.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string $table
|
||||
* @param \Closure|string $first
|
||||
* @param \Closure|\Illuminate\Contracts\Database\Query\Expression|string $first
|
||||
* @param string|null $operator
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string|null $second
|
||||
* @param string $type
|
||||
@@ -550,7 +550,7 @@ class Builder implements BuilderContract
|
||||
* Add a "join where" clause to the query.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string $table
|
||||
* @param \Closure|string $first
|
||||
* @param \Closure|\Illuminate\Contracts\Database\Query\Expression|string $first
|
||||
* @param string $operator
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string $second
|
||||
* @param string $type
|
||||
@@ -566,7 +566,7 @@ class Builder implements BuilderContract
|
||||
*
|
||||
* @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $query
|
||||
* @param string $as
|
||||
* @param \Closure|string $first
|
||||
* @param \Closure|\Illuminate\Contracts\Database\Query\Expression|string $first
|
||||
* @param string|null $operator
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string|null $second
|
||||
* @param string $type
|
||||
@@ -623,7 +623,7 @@ class Builder implements BuilderContract
|
||||
* Add a left join to the query.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string $table
|
||||
* @param \Closure|string $first
|
||||
* @param \Closure|\Illuminate\Contracts\Database\Query\Expression|string $first
|
||||
* @param string|null $operator
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string|null $second
|
||||
* @return $this
|
||||
@@ -637,7 +637,7 @@ class Builder implements BuilderContract
|
||||
* Add a "join where" clause to the query.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string $table
|
||||
* @param \Closure|string $first
|
||||
* @param \Closure|\Illuminate\Contracts\Database\Query\Expression|string $first
|
||||
* @param string $operator
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string|null $second
|
||||
* @return $this
|
||||
@@ -652,7 +652,7 @@ class Builder implements BuilderContract
|
||||
*
|
||||
* @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $query
|
||||
* @param string $as
|
||||
* @param \Closure|string $first
|
||||
* @param \Closure|\Illuminate\Contracts\Database\Query\Expression|string $first
|
||||
* @param string|null $operator
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string|null $second
|
||||
* @return $this
|
||||
@@ -680,7 +680,7 @@ class Builder implements BuilderContract
|
||||
* Add a "right join where" clause to the query.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string $table
|
||||
* @param \Closure|string $first
|
||||
* @param \Closure|\Illuminate\Contracts\Database\Query\Expression|string $first
|
||||
* @param string $operator
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string $second
|
||||
* @return $this
|
||||
@@ -695,7 +695,7 @@ class Builder implements BuilderContract
|
||||
*
|
||||
* @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $query
|
||||
* @param string $as
|
||||
* @param \Closure|string $first
|
||||
* @param \Closure|\Illuminate\Contracts\Database\Query\Expression|string $first
|
||||
* @param string|null $operator
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string|null $second
|
||||
* @return $this
|
||||
@@ -709,7 +709,7 @@ class Builder implements BuilderContract
|
||||
* Add a "cross join" clause to the query.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string $table
|
||||
* @param \Closure|string|null $first
|
||||
* @param \Closure|\Illuminate\Contracts\Database\Query\Expression|string|null $first
|
||||
* @param string|null $operator
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string|null $second
|
||||
* @return $this
|
||||
@@ -1029,7 +1029,7 @@ class Builder implements BuilderContract
|
||||
/**
|
||||
* Add a "where" clause comparing two columns to the query.
|
||||
*
|
||||
* @param string|array $first
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string|array $first
|
||||
* @param string|null $operator
|
||||
* @param string|null $second
|
||||
* @param string|null $boolean
|
||||
@@ -1066,7 +1066,7 @@ class Builder implements BuilderContract
|
||||
/**
|
||||
* Add an "or where" clause comparing two columns to the query.
|
||||
*
|
||||
* @param string|array $first
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string|array $first
|
||||
* @param string|null $operator
|
||||
* @param string|null $second
|
||||
* @return $this
|
||||
@@ -1207,7 +1207,7 @@ class Builder implements BuilderContract
|
||||
$values = Arr::flatten($values);
|
||||
|
||||
foreach ($values as &$value) {
|
||||
$value = (int) $value;
|
||||
$value = (int) ($value instanceof BackedEnum ? $value->value : $value);
|
||||
}
|
||||
|
||||
$this->wheres[] = compact('type', 'column', 'values', 'boolean');
|
||||
@@ -1436,6 +1436,13 @@ class Builder implements BuilderContract
|
||||
$value, $operator, func_num_args() === 2
|
||||
);
|
||||
|
||||
// If the given operator is not found in the list of valid operators we will
|
||||
// assume that the developer is just short-cutting the '=' operators and
|
||||
// we will set the operators to '=' and set the values appropriately.
|
||||
if ($this->invalidOperator($operator)) {
|
||||
[$value, $operator] = [$operator, '='];
|
||||
}
|
||||
|
||||
$value = $this->flattenValue($value);
|
||||
|
||||
if ($value instanceof DateTimeInterface) {
|
||||
@@ -1477,6 +1484,13 @@ class Builder implements BuilderContract
|
||||
$value, $operator, func_num_args() === 2
|
||||
);
|
||||
|
||||
// If the given operator is not found in the list of valid operators we will
|
||||
// assume that the developer is just short-cutting the '=' operators and
|
||||
// we will set the operators to '=' and set the values appropriately.
|
||||
if ($this->invalidOperator($operator)) {
|
||||
[$value, $operator] = [$operator, '='];
|
||||
}
|
||||
|
||||
$value = $this->flattenValue($value);
|
||||
|
||||
if ($value instanceof DateTimeInterface) {
|
||||
@@ -1518,6 +1532,13 @@ class Builder implements BuilderContract
|
||||
$value, $operator, func_num_args() === 2
|
||||
);
|
||||
|
||||
// If the given operator is not found in the list of valid operators we will
|
||||
// assume that the developer is just short-cutting the '=' operators and
|
||||
// we will set the operators to '=' and set the values appropriately.
|
||||
if ($this->invalidOperator($operator)) {
|
||||
[$value, $operator] = [$operator, '='];
|
||||
}
|
||||
|
||||
$value = $this->flattenValue($value);
|
||||
|
||||
if ($value instanceof DateTimeInterface) {
|
||||
@@ -1563,6 +1584,13 @@ class Builder implements BuilderContract
|
||||
$value, $operator, func_num_args() === 2
|
||||
);
|
||||
|
||||
// If the given operator is not found in the list of valid operators we will
|
||||
// assume that the developer is just short-cutting the '=' operators and
|
||||
// we will set the operators to '=' and set the values appropriately.
|
||||
if ($this->invalidOperator($operator)) {
|
||||
[$value, $operator] = [$operator, '='];
|
||||
}
|
||||
|
||||
$value = $this->flattenValue($value);
|
||||
|
||||
if ($value instanceof DateTimeInterface) {
|
||||
@@ -1608,6 +1636,13 @@ class Builder implements BuilderContract
|
||||
$value, $operator, func_num_args() === 2
|
||||
);
|
||||
|
||||
// If the given operator is not found in the list of valid operators we will
|
||||
// assume that the developer is just short-cutting the '=' operators and
|
||||
// we will set the operators to '=' and set the values appropriately.
|
||||
if ($this->invalidOperator($operator)) {
|
||||
[$value, $operator] = [$operator, '='];
|
||||
}
|
||||
|
||||
$value = $this->flattenValue($value);
|
||||
|
||||
if ($value instanceof DateTimeInterface) {
|
||||
@@ -1704,7 +1739,7 @@ class Builder implements BuilderContract
|
||||
*
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string $column
|
||||
* @param string $operator
|
||||
* @param \Closure||\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $callback
|
||||
* @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $callback
|
||||
* @param string $boolean
|
||||
* @return $this
|
||||
*/
|
||||
@@ -1974,6 +2009,13 @@ class Builder implements BuilderContract
|
||||
$value, $operator, func_num_args() === 2
|
||||
);
|
||||
|
||||
// If the given operator is not found in the list of valid operators we will
|
||||
// assume that the developer is just short-cutting the '=' operators and
|
||||
// we will set the operators to '=' and set the values appropriately.
|
||||
if ($this->invalidOperator($operator)) {
|
||||
[$value, $operator] = [$operator, '='];
|
||||
}
|
||||
|
||||
$this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean');
|
||||
|
||||
if (! $value instanceof ExpressionContract) {
|
||||
@@ -2095,6 +2137,80 @@ class Builder implements BuilderContract
|
||||
return $this->whereFulltext($columns, $value, $options, 'or');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a "where" clause to the query for multiple columns with "and" conditions between them.
|
||||
*
|
||||
* @param string[] $columns
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @param string $boolean
|
||||
* @return $this
|
||||
*/
|
||||
public function whereAll($columns, $operator = null, $value = null, $boolean = 'and')
|
||||
{
|
||||
[$value, $operator] = $this->prepareValueAndOperator(
|
||||
$value, $operator, func_num_args() === 2
|
||||
);
|
||||
|
||||
$this->whereNested(function ($query) use ($columns, $operator, $value) {
|
||||
foreach ($columns as $column) {
|
||||
$query->where($column, $operator, $value, 'and');
|
||||
}
|
||||
}, $boolean);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an "or where" clause to the query for multiple columns with "and" conditions between them.
|
||||
*
|
||||
* @param string[] $columns
|
||||
* @param string $operator
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
*/
|
||||
public function orWhereAll($columns, $operator = null, $value = null)
|
||||
{
|
||||
return $this->whereAll($columns, $operator, $value, 'or');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an "where" clause to the query for multiple columns with "or" conditions between them.
|
||||
*
|
||||
* @param string[] $columns
|
||||
* @param string $operator
|
||||
* @param mixed $value
|
||||
* @param string $boolean
|
||||
* @return $this
|
||||
*/
|
||||
public function whereAny($columns, $operator = null, $value = null, $boolean = 'and')
|
||||
{
|
||||
[$value, $operator] = $this->prepareValueAndOperator(
|
||||
$value, $operator, func_num_args() === 2
|
||||
);
|
||||
|
||||
$this->whereNested(function ($query) use ($columns, $operator, $value) {
|
||||
foreach ($columns as $column) {
|
||||
$query->where($column, $operator, $value, 'or');
|
||||
}
|
||||
}, $boolean);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an "or where" clause to the query for multiple columns with "or" conditions between them.
|
||||
*
|
||||
* @param string[] $columns
|
||||
* @param string $operator
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
*/
|
||||
public function orWhereAny($columns, $operator = null, $value = null)
|
||||
{
|
||||
return $this->whereAny($columns, $operator, $value, 'or');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a "group by" clause to the query.
|
||||
*
|
||||
@@ -2716,7 +2832,7 @@ class Builder implements BuilderContract
|
||||
* @param \Closure|null $callback
|
||||
* @return mixed|static
|
||||
*/
|
||||
public function findOr($id, $columns = ['*'], Closure $callback = null)
|
||||
public function findOr($id, $columns = ['*'], ?Closure $callback = null)
|
||||
{
|
||||
if ($columns instanceof Closure) {
|
||||
$callback = $columns;
|
||||
@@ -2942,10 +3058,10 @@ class Builder implements BuilderContract
|
||||
->get()->all();
|
||||
}
|
||||
|
||||
$without = $this->unions ? ['orders', 'limit', 'offset'] : ['columns', 'orders', 'limit', 'offset'];
|
||||
$without = $this->unions ? ['unionOrders', 'unionLimit', 'unionOffset'] : ['columns', 'orders', 'limit', 'offset'];
|
||||
|
||||
return $this->cloneWithout($without)
|
||||
->cloneWithoutBindings($this->unions ? ['order'] : ['select', 'order'])
|
||||
->cloneWithoutBindings($this->unions ? ['unionOrder'] : ['select', 'order'])
|
||||
->setAggregate('count', $this->withoutSelectAliases($columns))
|
||||
->get()->all();
|
||||
}
|
||||
@@ -3741,6 +3857,18 @@ class Builder implements BuilderContract
|
||||
return $this->connection->raw($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the query builder instances that are used in the union of the query.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
protected function getUnionBuilders()
|
||||
{
|
||||
return isset($this->unions)
|
||||
? collect($this->unions)->pluck('query')
|
||||
: collect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current query value bindings in a flattened array.
|
||||
*
|
||||
|
||||
Vendored
+2
-2
@@ -82,7 +82,7 @@ class JoinClause extends Builder
|
||||
*
|
||||
* on `contacts`.`user_id` = `users`.`id` and `contacts`.`info_id` = `info`.`id`
|
||||
*
|
||||
* @param \Closure|string $first
|
||||
* @param \Closure|\Illuminate\Contracts\Database\Query\Expression|string $first
|
||||
* @param string|null $operator
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string|null $second
|
||||
* @param string $boolean
|
||||
@@ -102,7 +102,7 @@ class JoinClause extends Builder
|
||||
/**
|
||||
* Add an "or on" clause to the join.
|
||||
*
|
||||
* @param \Closure|string $first
|
||||
* @param \Closure|\Illuminate\Contracts\Database\Query\Expression|string $first
|
||||
* @param string|null $operator
|
||||
* @param \Illuminate\Contracts\Database\Query\Expression|string|null $second
|
||||
* @return \Illuminate\Database\Query\JoinClause
|
||||
|
||||
+20
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace Illuminate\Database\Query\Processors;
|
||||
|
||||
use Illuminate\Database\Query\Builder;
|
||||
|
||||
class MySqlProcessor extends Processor
|
||||
{
|
||||
/**
|
||||
@@ -19,6 +21,24 @@ class MySqlProcessor extends Processor
|
||||
}, $results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process an "insert get ID" query.
|
||||
*
|
||||
* @param \Illuminate\Database\Query\Builder $query
|
||||
* @param string $sql
|
||||
* @param array $values
|
||||
* @param string|null $sequence
|
||||
* @return int
|
||||
*/
|
||||
public function processInsertGetId(Builder $query, $sql, $values, $sequence = null)
|
||||
{
|
||||
$query->getConnection()->insert($sql, $values, $sequence);
|
||||
|
||||
$id = $query->getConnection()->getLastInsertId();
|
||||
|
||||
return is_numeric($id) ? (int) $id : $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the results of a columns query.
|
||||
*
|
||||
|
||||
Vendored
+1
-1
@@ -107,7 +107,7 @@ class SQLiteConnection extends Connection
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function getSchemaState(Filesystem $files = null, callable $processFactory = null)
|
||||
public function getSchemaState(?Filesystem $files = null, ?callable $processFactory = null)
|
||||
{
|
||||
return new SqliteSchemaState($this, $files, $processFactory);
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -87,7 +87,7 @@ class Blueprint
|
||||
* @param string $prefix
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($table, Closure $callback = null, $prefix = '')
|
||||
public function __construct($table, ?Closure $callback = null, $prefix = '')
|
||||
{
|
||||
$this->table = $table;
|
||||
$this->prefix = $prefix;
|
||||
|
||||
+2
-2
@@ -162,7 +162,7 @@ class Builder
|
||||
{
|
||||
$table = $this->connection->getTablePrefix().$table;
|
||||
|
||||
foreach ($this->getTables() as $value) {
|
||||
foreach ($this->getTables(false) as $value) {
|
||||
if (strtolower($table) === strtolower($value['name'])) {
|
||||
return true;
|
||||
}
|
||||
@@ -609,7 +609,7 @@ class Builder
|
||||
* @param \Closure|null $callback
|
||||
* @return \Illuminate\Database\Schema\Blueprint
|
||||
*/
|
||||
protected function createBlueprint($table, Closure $callback = null)
|
||||
protected function createBlueprint($table, ?Closure $callback = null)
|
||||
{
|
||||
$prefix = $this->connection->getConfig('prefix_indexes')
|
||||
? $this->connection->getConfig('prefix')
|
||||
|
||||
+5
-5
@@ -123,7 +123,7 @@ class SQLiteGrammar extends Grammar
|
||||
return sprintf(
|
||||
'select name, type, not "notnull" as "nullable", dflt_value as "default", pk as "primary" '
|
||||
.'from pragma_table_info(%s) order by cid asc',
|
||||
$this->wrap(str_replace('.', '__', $table))
|
||||
$this->quoteString(str_replace('.', '__', $table))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -136,12 +136,12 @@ class SQLiteGrammar extends Grammar
|
||||
public function compileIndexes($table)
|
||||
{
|
||||
return sprintf(
|
||||
'select "primary" as name, group_concat(col) as columns, 1 as "unique", 1 as "primary" '
|
||||
'select \'primary\' as name, group_concat(col) as columns, 1 as "unique", 1 as "primary" '
|
||||
.'from (select name as col from pragma_table_info(%s) where pk > 0 order by pk, cid) group by name '
|
||||
.'union select name, group_concat(col) as columns, "unique", origin = "pk" as "primary" '
|
||||
.'union select name, group_concat(col) as columns, "unique", origin = \'pk\' as "primary" '
|
||||
.'from (select il.*, ii.name as col from pragma_index_list(%s) il, pragma_index_info(il.name) ii order by il.seq, ii.seqno) '
|
||||
.'group by name, "unique", "primary"',
|
||||
$table = $this->wrap(str_replace('.', '__', $table)),
|
||||
$table = $this->quoteString(str_replace('.', '__', $table)),
|
||||
$table
|
||||
);
|
||||
}
|
||||
@@ -159,7 +159,7 @@ class SQLiteGrammar extends Grammar
|
||||
.'group_concat("to") as foreign_columns, on_update, on_delete '
|
||||
.'from (select * from pragma_foreign_key_list(%s) order by id desc, seq) '
|
||||
.'group by id, "table", on_update, on_delete',
|
||||
$this->wrap(str_replace('.', '__', $table))
|
||||
$this->quoteString(str_replace('.', '__', $table))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+3
-1
@@ -26,7 +26,9 @@ class MySqlSchemaState extends SchemaState
|
||||
|
||||
$this->removeAutoIncrementingState($path);
|
||||
|
||||
$this->appendMigrationData($path);
|
||||
if ($this->hasMigrationTable()) {
|
||||
$this->appendMigrationData($path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+4
-1
@@ -17,9 +17,12 @@ class PostgresSchemaState extends SchemaState
|
||||
{
|
||||
$commands = collect([
|
||||
$this->baseDumpCommand().' --schema-only > '.$path,
|
||||
$this->baseDumpCommand().' -t '.$this->migrationTable.' --data-only >> '.$path,
|
||||
]);
|
||||
|
||||
if ($this->hasMigrationTable()) {
|
||||
$commands->push($this->baseDumpCommand().' -t '.$this->migrationTable.' --data-only >> '.$path);
|
||||
}
|
||||
|
||||
$commands->map(function ($command, $path) {
|
||||
$this->makeProcess($command)->mustRun($this->output, array_merge($this->baseVariables($this->connection->getConfig()), [
|
||||
'LARAVEL_LOAD_PATH' => $path,
|
||||
|
||||
Vendored
+8
-7
@@ -34,16 +34,17 @@ class SQLiteBuilder extends Builder
|
||||
/**
|
||||
* Get the tables for the database.
|
||||
*
|
||||
* @param bool $withSize
|
||||
* @return array
|
||||
*/
|
||||
public function getTables()
|
||||
public function getTables($withSize = true)
|
||||
{
|
||||
$withSize = false;
|
||||
|
||||
try {
|
||||
$withSize = $this->connection->scalar($this->grammar->compileDbstatExists());
|
||||
} catch (QueryException $e) {
|
||||
//
|
||||
if ($withSize) {
|
||||
try {
|
||||
$withSize = $this->connection->scalar($this->grammar->compileDbstatExists());
|
||||
} catch (QueryException $e) {
|
||||
$withSize = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->connection->getPostProcessor()->processTables(
|
||||
|
||||
Vendored
+11
-1
@@ -51,7 +51,7 @@ abstract class SchemaState
|
||||
* @param callable|null $processFactory
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Connection $connection, Filesystem $files = null, callable $processFactory = null)
|
||||
public function __construct(Connection $connection, ?Filesystem $files = null, ?callable $processFactory = null)
|
||||
{
|
||||
$this->connection = $connection;
|
||||
|
||||
@@ -94,6 +94,16 @@ abstract class SchemaState
|
||||
return call_user_func($this->processFactory, ...$arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the current connection has a migration table.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasMigrationTable(): bool
|
||||
{
|
||||
return $this->connection->getSchemaBuilder()->hasTable($this->migrationTable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the name of the application's migration table.
|
||||
*
|
||||
|
||||
Vendored
+3
-1
@@ -28,7 +28,9 @@ class SqliteSchemaState extends SchemaState
|
||||
|
||||
$this->files->put($path, implode(PHP_EOL, $migrations).PHP_EOL);
|
||||
|
||||
$this->appendMigrationData($path);
|
||||
if ($this->hasMigrationTable()) {
|
||||
$this->appendMigrationData($path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+1
-1
@@ -125,7 +125,7 @@ class SqlServerConnection extends Connection
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function getSchemaState(Filesystem $files = null, callable $processFactory = null)
|
||||
public function getSchemaState(?Filesystem $files = null, ?callable $processFactory = null)
|
||||
{
|
||||
throw new RuntimeException('Schema dumping is not supported when using SQL Server.');
|
||||
}
|
||||
|
||||
Vendored
+7
@@ -68,6 +68,13 @@ class CallQueuedListener implements ShouldQueue
|
||||
*/
|
||||
public $timeout;
|
||||
|
||||
/**
|
||||
* Indicates if the job should fail if the timeout is exceeded.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $failOnTimeout = false;
|
||||
|
||||
/**
|
||||
* Indicates if the job should be encrypted.
|
||||
*
|
||||
|
||||
+2
-1
@@ -72,7 +72,7 @@ class Dispatcher implements DispatcherContract
|
||||
* @param \Illuminate\Contracts\Container\Container|null $container
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ContainerContract $container = null)
|
||||
public function __construct(?ContainerContract $container = null)
|
||||
{
|
||||
$this->container = $container ?: new Container;
|
||||
}
|
||||
@@ -674,6 +674,7 @@ class Dispatcher implements DispatcherContract
|
||||
$job->retryUntil = method_exists($listener, 'retryUntil') ? $listener->retryUntil(...$data) : null;
|
||||
$job->shouldBeEncrypted = $listener instanceof ShouldBeEncrypted;
|
||||
$job->timeout = $listener->timeout ?? null;
|
||||
$job->failOnTimeout = $listener->failOnTimeout ?? false;
|
||||
$job->tries = $listener->tries ?? null;
|
||||
|
||||
$job->through(array_merge(
|
||||
|
||||
+2
-3
@@ -16,8 +16,7 @@ use Symfony\Component\Mime\MimeTypes;
|
||||
|
||||
class Filesystem
|
||||
{
|
||||
use Conditionable;
|
||||
use Macroable;
|
||||
use Conditionable, Macroable;
|
||||
|
||||
/**
|
||||
* Determine if a file or directory exists.
|
||||
@@ -348,7 +347,7 @@ class Filesystem
|
||||
*
|
||||
* @param string $target
|
||||
* @param string $link
|
||||
* @return void
|
||||
* @return bool|null
|
||||
*/
|
||||
public function link($target, $link)
|
||||
{
|
||||
|
||||
+8
-2
@@ -40,7 +40,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const VERSION = '10.46.0';
|
||||
const VERSION = '10.48.25';
|
||||
|
||||
/**
|
||||
* The base path for the Laravel installation.
|
||||
@@ -535,6 +535,10 @@ class Application extends Container implements ApplicationContract, CachesConfig
|
||||
return $this->joinPaths($this->storagePath ?: $_ENV['LARAVEL_STORAGE_PATH'], $path);
|
||||
}
|
||||
|
||||
if (isset($_SERVER['LARAVEL_STORAGE_PATH'])) {
|
||||
return $this->joinPaths($this->storagePath ?: $_SERVER['LARAVEL_STORAGE_PATH'], $path);
|
||||
}
|
||||
|
||||
return $this->joinPaths($this->storagePath ?: $this->basePath('storage'), $path);
|
||||
}
|
||||
|
||||
@@ -692,7 +696,9 @@ class Application extends Container implements ApplicationContract, CachesConfig
|
||||
*/
|
||||
public function detectEnvironment(Closure $callback)
|
||||
{
|
||||
$args = $_SERVER['argv'] ?? null;
|
||||
$args = $this->runningInConsole() && isset($_SERVER['argv'])
|
||||
? $_SERVER['argv']
|
||||
: null;
|
||||
|
||||
return $this['env'] = (new EnvironmentDetector)->detect($callback, $args);
|
||||
}
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ class LoadEnvironmentVariables
|
||||
* Write the error information to the screen and exit.
|
||||
*
|
||||
* @param \Dotenv\Exception\InvalidFileException $e
|
||||
* @return void
|
||||
* @return never
|
||||
*/
|
||||
protected function writeErrorAndDie(InvalidFileException $e)
|
||||
{
|
||||
|
||||
Vendored
+3
-3
@@ -232,7 +232,7 @@ class AboutCommand extends Command
|
||||
* @param string|null $value
|
||||
* @return void
|
||||
*/
|
||||
public static function add(string $section, $data, string $value = null)
|
||||
public static function add(string $section, $data, ?string $value = null)
|
||||
{
|
||||
static::$customDataResolvers[] = fn () => static::addToSection($section, $data, $value);
|
||||
}
|
||||
@@ -245,7 +245,7 @@ class AboutCommand extends Command
|
||||
* @param string|null $value
|
||||
* @return void
|
||||
*/
|
||||
protected static function addToSection(string $section, $data, string $value = null)
|
||||
protected static function addToSection(string $section, $data, ?string $value = null)
|
||||
{
|
||||
if (is_array($data)) {
|
||||
foreach ($data as $key => $value) {
|
||||
@@ -279,7 +279,7 @@ class AboutCommand extends Command
|
||||
* @param (\Closure(mixed):(mixed))|null $json
|
||||
* @return \Closure(bool):mixed
|
||||
*/
|
||||
public static function format($value, Closure $console = null, Closure $json = null)
|
||||
public static function format($value, ?Closure $console = null, ?Closure $json = null)
|
||||
{
|
||||
return function ($isJson) use ($value, $console, $json) {
|
||||
if ($isJson === true && $json instanceof Closure) {
|
||||
|
||||
Vendored
+1
-1
@@ -295,7 +295,7 @@ class ServeCommand extends Command
|
||||
|
||||
$this->output->write(' '.str_repeat('<fg=gray>.</>', $dots));
|
||||
$this->output->writeln(" <fg=gray>~ {$runTime}s</>");
|
||||
} elseif (str($line)->contains(['Closed without sending a request'])) {
|
||||
} elseif (str($line)->contains(['Closed without sending a request', 'Failed to poll event'])) {
|
||||
// ...
|
||||
} elseif (! empty($line)) {
|
||||
$position = strpos($line, '] ');
|
||||
|
||||
Vendored
+1
-1
@@ -65,7 +65,7 @@ class EnvironmentDetector
|
||||
return $args[$i + 1] ?? null;
|
||||
}
|
||||
|
||||
if (str_starts_with($value, '--env')) {
|
||||
if (str_starts_with($value, '--env=')) {
|
||||
return head(array_slice(explode('=', $value), 1));
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -226,7 +226,7 @@ class FormRequest extends Request implements ValidatesWhenResolved
|
||||
* @param array|null $keys
|
||||
* @return \Illuminate\Support\ValidatedInput|array
|
||||
*/
|
||||
public function safe(array $keys = null)
|
||||
public function safe(?array $keys = null)
|
||||
{
|
||||
return is_array($keys)
|
||||
? $this->validator->safe()->only($keys)
|
||||
|
||||
+3
-3
@@ -58,7 +58,7 @@ trait InteractsWithContainer
|
||||
* @param \Closure|null $mock
|
||||
* @return \Mockery\MockInterface
|
||||
*/
|
||||
protected function mock($abstract, Closure $mock = null)
|
||||
protected function mock($abstract, ?Closure $mock = null)
|
||||
{
|
||||
return $this->instance($abstract, Mockery::mock(...array_filter(func_get_args())));
|
||||
}
|
||||
@@ -70,7 +70,7 @@ trait InteractsWithContainer
|
||||
* @param \Closure|null $mock
|
||||
* @return \Mockery\MockInterface
|
||||
*/
|
||||
protected function partialMock($abstract, Closure $mock = null)
|
||||
protected function partialMock($abstract, ?Closure $mock = null)
|
||||
{
|
||||
return $this->instance($abstract, Mockery::mock(...array_filter(func_get_args()))->makePartial());
|
||||
}
|
||||
@@ -82,7 +82,7 @@ trait InteractsWithContainer
|
||||
* @param \Closure|null $mock
|
||||
* @return \Mockery\MockInterface
|
||||
*/
|
||||
protected function spy($abstract, Closure $mock = null)
|
||||
protected function spy($abstract, ?Closure $mock = null)
|
||||
{
|
||||
return $this->instance($abstract, Mockery::spy(...array_filter(func_get_args())));
|
||||
}
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ trait ValidatesRequests
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
*/
|
||||
public function validateWith($validator, Request $request = null)
|
||||
public function validateWith($validator, ?Request $request = null)
|
||||
{
|
||||
$request = $request ?: request();
|
||||
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ class Factory
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher|null $dispatcher
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Dispatcher $dispatcher = null)
|
||||
public function __construct(?Dispatcher $dispatcher = null)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
|
||||
|
||||
Vendored
+8
-4
@@ -222,7 +222,7 @@ class PendingRequest
|
||||
* @param array $middleware
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Factory $factory = null, $middleware = [])
|
||||
public function __construct(?Factory $factory = null, $middleware = [])
|
||||
{
|
||||
$this->factory = $factory;
|
||||
$this->middleware = new Collection($middleware);
|
||||
@@ -690,7 +690,7 @@ class PendingRequest
|
||||
* @param callable|null $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function throw(callable $callback = null)
|
||||
public function throw(?callable $callback = null)
|
||||
{
|
||||
$this->throwCallback = $callback ?: fn () => null;
|
||||
|
||||
@@ -911,11 +911,15 @@ class PendingRequest
|
||||
$response->throw($this->throwCallback);
|
||||
}
|
||||
|
||||
if ($attempt < $this->tries && $shouldRetry) {
|
||||
$potentialTries = is_array($this->tries)
|
||||
? count($this->tries) + 1
|
||||
: $this->tries;
|
||||
|
||||
if ($attempt < $potentialTries && $shouldRetry) {
|
||||
$response->throw();
|
||||
}
|
||||
|
||||
if ($this->tries > 1 && $this->retryThrow) {
|
||||
if ($potentialTries > 1 && $this->retryThrow) {
|
||||
$response->throw();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ class Pool
|
||||
* @param \Illuminate\Http\Client\Factory|null $factory
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Factory $factory = null)
|
||||
public function __construct(?Factory $factory = null)
|
||||
{
|
||||
$this->factory = $factory ?: new Factory();
|
||||
$this->handler = Utils::chooseHandler();
|
||||
|
||||
Vendored
+3
-3
@@ -120,7 +120,7 @@ trait InteractsWithInput
|
||||
* @param callable|null $default
|
||||
* @return $this|mixed
|
||||
*/
|
||||
public function whenHas($key, callable $callback, callable $default = null)
|
||||
public function whenHas($key, callable $callback, ?callable $default = null)
|
||||
{
|
||||
if ($this->has($key)) {
|
||||
return $callback(data_get($this->all(), $key)) ?: $this;
|
||||
@@ -198,7 +198,7 @@ trait InteractsWithInput
|
||||
* @param callable|null $default
|
||||
* @return $this|mixed
|
||||
*/
|
||||
public function whenFilled($key, callable $callback, callable $default = null)
|
||||
public function whenFilled($key, callable $callback, ?callable $default = null)
|
||||
{
|
||||
if ($this->filled($key)) {
|
||||
return $callback(data_get($this->all(), $key)) ?: $this;
|
||||
@@ -232,7 +232,7 @@ trait InteractsWithInput
|
||||
* @param callable|null $default
|
||||
* @return $this|mixed
|
||||
*/
|
||||
public function whenMissing($key, callable $callback, callable $default = null)
|
||||
public function whenMissing($key, callable $callback, ?callable $default = null)
|
||||
{
|
||||
if ($this->missing($key)) {
|
||||
return $callback(data_get($this->all(), $key)) ?: $this;
|
||||
|
||||
+5
-1
@@ -4,6 +4,7 @@ namespace Illuminate\Http\Exceptions;
|
||||
|
||||
use RuntimeException;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Throwable;
|
||||
|
||||
class HttpResponseException extends RuntimeException
|
||||
{
|
||||
@@ -18,10 +19,13 @@ class HttpResponseException extends RuntimeException
|
||||
* Create a new HTTP response exception instance.
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Response $response
|
||||
* @param \Throwable $previous
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Response $response)
|
||||
public function __construct(Response $response, ?Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($previous?->getMessage() ?? '', $previous?->getCode() ?? 0, $previous);
|
||||
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ class PostTooLargeException extends HttpException
|
||||
* @param int $code
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($message = '', Throwable $previous = null, array $headers = [], $code = 0)
|
||||
public function __construct($message = '', ?Throwable $previous = null, array $headers = [], $code = 0)
|
||||
{
|
||||
parent::__construct(413, $message, $previous, $headers, $code);
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ class ThrottleRequestsException extends TooManyRequestsHttpException
|
||||
* @param int $code
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($message = '', Throwable $previous = null, array $headers = [], $code = 0)
|
||||
public function __construct($message = '', ?Throwable $previous = null, array $headers = [], $code = 0)
|
||||
{
|
||||
parent::__construct(null, $message, $previous, $code, $headers);
|
||||
}
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Illuminate\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Vite;
|
||||
|
||||
@@ -17,7 +18,7 @@ class AddLinkHeadersForPreloadedAssets
|
||||
public function handle($request, $next)
|
||||
{
|
||||
return tap($next($request), function ($response) {
|
||||
if (Vite::preloadedAssets() !== []) {
|
||||
if ($response instanceof Response && Vite::preloadedAssets() !== []) {
|
||||
$response->header('Link', Collection::make(Vite::preloadedAssets())
|
||||
->map(fn ($attributes, $url) => "<{$url}>; ".implode('; ', $attributes))
|
||||
->join(', '));
|
||||
|
||||
Vendored
+6
@@ -49,6 +49,12 @@ class TrustProxies
|
||||
{
|
||||
$trustedIps = $this->proxies() ?: config('trustedproxy.proxies');
|
||||
|
||||
if (is_null($trustedIps) &&
|
||||
(($_ENV['LARAVEL_CLOUD'] ?? false) === '1' ||
|
||||
($_SERVER['LARAVEL_CLOUD'] ?? false) === '1')) {
|
||||
$trustedIps = '*';
|
||||
}
|
||||
|
||||
if ($trustedIps === '*' || $trustedIps === '**') {
|
||||
return $this->setTrustedProxyIpAddressesToTheCallingIp($request);
|
||||
}
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ class RedirectResponse extends BaseRedirectResponse
|
||||
* @param array|null $input
|
||||
* @return $this
|
||||
*/
|
||||
public function withInput(array $input = null)
|
||||
public function withInput(?array $input = null)
|
||||
{
|
||||
$this->session->flashInput($this->removeFilesFromInput(
|
||||
! is_null($input) ? $input : $this->request->input()
|
||||
|
||||
+2
-2
@@ -404,7 +404,7 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
|
||||
public function json($key = null, $default = null)
|
||||
{
|
||||
if (! isset($this->json)) {
|
||||
$this->json = new InputBag((array) json_decode($this->getContent(), true));
|
||||
$this->json = new InputBag((array) json_decode($this->getContent() ?: '[]', true));
|
||||
}
|
||||
|
||||
if (is_null($key)) {
|
||||
@@ -499,7 +499,7 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null): static
|
||||
public function duplicate(?array $query = null, ?array $request = null, ?array $attributes = null, ?array $cookies = null, ?array $files = null, ?array $server = null): static
|
||||
{
|
||||
return parent::duplicate($query, $request, $attributes, $cookies, $this->filterFiles($files), $server);
|
||||
}
|
||||
|
||||
Vendored
+5
-4
@@ -12,6 +12,7 @@ use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\ConditionallyLoadsAttributes;
|
||||
use Illuminate\Http\Resources\DelegatesToResource;
|
||||
use JsonException;
|
||||
use JsonSerializable;
|
||||
|
||||
class JsonResource implements ArrayAccess, JsonSerializable, Responsable, UrlRoutable
|
||||
@@ -144,10 +145,10 @@ class JsonResource implements ArrayAccess, JsonSerializable, Responsable, UrlRou
|
||||
*/
|
||||
public function toJson($options = 0)
|
||||
{
|
||||
$json = json_encode($this->jsonSerialize(), $options);
|
||||
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
throw JsonEncodingException::forResource($this, json_last_error_msg());
|
||||
try {
|
||||
$json = json_encode($this->jsonSerialize(), $options | JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException $e) {
|
||||
throw JsonEncodingException::forResource($this, $e->getMessage());
|
||||
}
|
||||
|
||||
return $json;
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ class Logger implements LoggerInterface
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher|null $dispatcher
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(LoggerInterface $logger, Dispatcher $dispatcher = null)
|
||||
public function __construct(LoggerInterface $logger, ?Dispatcher $dispatcher = null)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
$this->dispatcher = $dispatcher;
|
||||
|
||||
+1
-1
@@ -259,7 +259,7 @@ class MailManager implements FactoryContract
|
||||
* Create an instance of the Symfony Amazon SES V2 Transport driver.
|
||||
*
|
||||
* @param array $config
|
||||
* @return \Illuminate\Mail\Transport\Se2VwTransport
|
||||
* @return \Illuminate\Mail\Transport\SesV2Transport
|
||||
*/
|
||||
protected function createSesV2Transport(array $config)
|
||||
{
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ class Address
|
||||
* @param string|null $name
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(string $address, string $name = null)
|
||||
public function __construct(string $address, ?string $name = null)
|
||||
{
|
||||
$this->address = $address;
|
||||
$this->name = $name;
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ class Content
|
||||
*
|
||||
* @named-arguments-supported
|
||||
*/
|
||||
public function __construct(string $view = null, string $html = null, string $text = null, $markdown = null, array $with = [], string $htmlString = null)
|
||||
public function __construct(?string $view = null, ?string $html = null, ?string $text = null, $markdown = null, array $with = [], ?string $htmlString = null)
|
||||
{
|
||||
$this->view = $view;
|
||||
$this->html = $html;
|
||||
|
||||
+16
-16
@@ -77,10 +77,10 @@ class Envelope
|
||||
* Create a new message envelope instance.
|
||||
*
|
||||
* @param \Illuminate\Mail\Mailables\Address|string|null $from
|
||||
* @param array $to
|
||||
* @param array $cc
|
||||
* @param array $bcc
|
||||
* @param array $replyTo
|
||||
* @param array<int, \Illuminate\Mail\Mailables\Address|string> $to
|
||||
* @param array<int, \Illuminate\Mail\Mailables\Address|string> $cc
|
||||
* @param array<int, \Illuminate\Mail\Mailables\Address|string> $bcc
|
||||
* @param array<int, \Illuminate\Mail\Mailables\Address|string> $replyTo
|
||||
* @param string|null $subject
|
||||
* @param array $tags
|
||||
* @param array $metadata
|
||||
@@ -89,7 +89,7 @@ class Envelope
|
||||
*
|
||||
* @named-arguments-supported
|
||||
*/
|
||||
public function __construct(Address|string $from = null, $to = [], $cc = [], $bcc = [], $replyTo = [], string $subject = null, array $tags = [], array $metadata = [], Closure|array $using = [])
|
||||
public function __construct(Address|string|null $from = null, $to = [], $cc = [], $bcc = [], $replyTo = [], ?string $subject = null, array $tags = [], array $metadata = [], Closure|array $using = [])
|
||||
{
|
||||
$this->from = is_string($from) ? new Address($from) : $from;
|
||||
$this->to = $this->normalizeAddresses($to);
|
||||
@@ -105,8 +105,8 @@ class Envelope
|
||||
/**
|
||||
* Normalize the given array of addresses.
|
||||
*
|
||||
* @param array $addresses
|
||||
* @return array
|
||||
* @param array<int, \Illuminate\Mail\Mailables\Address|string> $addresses
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Address>
|
||||
*/
|
||||
protected function normalizeAddresses($addresses)
|
||||
{
|
||||
@@ -132,7 +132,7 @@ class Envelope
|
||||
/**
|
||||
* Add a "to" recipient to the message envelope.
|
||||
*
|
||||
* @param \Illuminate\Mail\Mailables\Address|array|string $address
|
||||
* @param \Illuminate\Mail\Mailables\Address|array<int, \Illuminate\Mail\Mailables\Address|string>|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
@@ -148,7 +148,7 @@ class Envelope
|
||||
/**
|
||||
* Add a "cc" recipient to the message envelope.
|
||||
*
|
||||
* @param \Illuminate\Mail\Mailables\Address|array|string $address
|
||||
* @param \Illuminate\Mail\Mailables\Address|array<int, \Illuminate\Mail\Mailables\Address|string>|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
@@ -164,7 +164,7 @@ class Envelope
|
||||
/**
|
||||
* Add a "bcc" recipient to the message envelope.
|
||||
*
|
||||
* @param \Illuminate\Mail\Mailables\Address|array|string $address
|
||||
* @param \Illuminate\Mail\Mailables\Address|array<int, \Illuminate\Mail\Mailables\Address|string>|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
@@ -180,7 +180,7 @@ class Envelope
|
||||
/**
|
||||
* Add a "reply to" recipient to the message envelope.
|
||||
*
|
||||
* @param \Illuminate\Mail\Mailables\Address|array|string $address
|
||||
* @param \Illuminate\Mail\Mailables\Address|array<int, \Illuminate\Mail\Mailables\Address|string>|string $address
|
||||
* @param string|null $name
|
||||
* @return $this
|
||||
*/
|
||||
@@ -266,7 +266,7 @@ class Envelope
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function isFrom(string $address, string $name = null)
|
||||
public function isFrom(string $address, ?string $name = null)
|
||||
{
|
||||
if (is_null($name)) {
|
||||
return $this->from->address === $address;
|
||||
@@ -283,7 +283,7 @@ class Envelope
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasTo(string $address, string $name = null)
|
||||
public function hasTo(string $address, ?string $name = null)
|
||||
{
|
||||
return $this->hasRecipient($this->to, $address, $name);
|
||||
}
|
||||
@@ -295,7 +295,7 @@ class Envelope
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasCc(string $address, string $name = null)
|
||||
public function hasCc(string $address, ?string $name = null)
|
||||
{
|
||||
return $this->hasRecipient($this->cc, $address, $name);
|
||||
}
|
||||
@@ -307,7 +307,7 @@ class Envelope
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasBcc(string $address, string $name = null)
|
||||
public function hasBcc(string $address, ?string $name = null)
|
||||
{
|
||||
return $this->hasRecipient($this->bcc, $address, $name);
|
||||
}
|
||||
@@ -319,7 +319,7 @@ class Envelope
|
||||
* @param string|null $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasReplyTo(string $address, string $name = null)
|
||||
public function hasReplyTo(string $address, ?string $name = null)
|
||||
{
|
||||
return $this->hasRecipient($this->replyTo, $address, $name);
|
||||
}
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ class Headers
|
||||
*
|
||||
* @named-arguments-supported
|
||||
*/
|
||||
public function __construct(string $messageId = null, array $references = [], array $text = [])
|
||||
public function __construct(?string $messageId = null, array $references = [], array $text = [])
|
||||
{
|
||||
$this->messageId = $messageId;
|
||||
$this->references = $references;
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ class Mailer implements MailerContract, MailQueueContract
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher|null $events
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(string $name, Factory $views, TransportInterface $transport, Dispatcher $events = null)
|
||||
public function __construct(string $name, Factory $views, TransportInterface $transport, ?Dispatcher $events = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->views = $views;
|
||||
|
||||
Vendored
+1
-1
@@ -30,7 +30,7 @@ class ArrayTransport implements TransportInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage
|
||||
public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMessage
|
||||
{
|
||||
return $this->messages[] = new SentMessage($message, $envelope ?? Envelope::create($message));
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -32,7 +32,7 @@ class LogTransport implements TransportInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage
|
||||
public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMessage
|
||||
{
|
||||
$string = Str::of($message->toString());
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -51,7 +51,7 @@ class SesV2Transport extends AbstractTransport
|
||||
if ($message->getOriginalMessage() instanceof Message) {
|
||||
foreach ($message->getOriginalMessage()->getHeaders()->all() as $header) {
|
||||
if ($header instanceof MetadataHeader) {
|
||||
$options['Tags'][] = ['Name' => $header->getKey(), 'Value' => $header->getValue()];
|
||||
$options['EmailTags'][] = ['Name' => $header->getKey(), 'Value' => $header->getValue()];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
[{{ $slot }}]({{ $url }})
|
||||
{{ $slot }}: {{ $url }}
|
||||
|
||||
Vendored
+1
-1
@@ -47,7 +47,7 @@ class ChannelManager extends Manager implements DispatcherContract, FactoryContr
|
||||
* @param array|null $channels
|
||||
* @return void
|
||||
*/
|
||||
public function sendNow($notifiables, $notification, array $channels = null)
|
||||
public function sendNow($notifiables, $notification, ?array $channels = null)
|
||||
{
|
||||
(new NotificationSender(
|
||||
$this, $this->container->make(Bus::class), $this->container->make(Dispatcher::class), $this->locale)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user