updated packages
This commit is contained in:
+2
-4
@@ -309,9 +309,7 @@ trait InteractsWithInput
|
||||
{
|
||||
$files = $this->files->all();
|
||||
|
||||
return $this->convertedFiles
|
||||
? $this->convertedFiles
|
||||
: $this->convertedFiles = $this->convertUploadedFiles($files);
|
||||
return $this->convertedFiles = $this->convertedFiles ?? $this->convertUploadedFiles($files);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -370,7 +368,7 @@ trait InteractsWithInput
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return \Illuminate\Http\UploadedFile|array|null
|
||||
* @return \Illuminate\Http\UploadedFile|\Illuminate\Http\UploadedFile[]|array|null
|
||||
*/
|
||||
public function file($key = null, $default = null)
|
||||
{
|
||||
|
||||
@@ -33,16 +33,6 @@ trait FileHelpers
|
||||
return $this->guessExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file's extension supplied by the client.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function clientExtension()
|
||||
{
|
||||
return $this->guessClientExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a filename for the file.
|
||||
*
|
||||
|
||||
+4
-4
@@ -37,7 +37,7 @@ class RedirectResponse extends BaseRedirectResponse
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @return $this
|
||||
*/
|
||||
public function with($key, $value = null)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ class RedirectResponse extends BaseRedirectResponse
|
||||
/**
|
||||
* Flash an array of input to the session.
|
||||
*
|
||||
* @param array $input
|
||||
* @param array|null $input
|
||||
* @return $this
|
||||
*/
|
||||
public function withInput(array $input = null)
|
||||
@@ -114,7 +114,7 @@ class RedirectResponse extends BaseRedirectResponse
|
||||
/**
|
||||
* Flash an array of input to the session.
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @return $this
|
||||
*/
|
||||
public function exceptInput()
|
||||
{
|
||||
@@ -217,7 +217,7 @@ class RedirectResponse extends BaseRedirectResponse
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return $this
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
|
||||
+15
-9
@@ -184,8 +184,10 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
|
||||
*/
|
||||
public function is(...$patterns)
|
||||
{
|
||||
$path = $this->decodedPath();
|
||||
|
||||
foreach ($patterns as $pattern) {
|
||||
if (Str::is($pattern, $this->decodedPath())) {
|
||||
if (Str::is($pattern, $path)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -267,7 +269,7 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
|
||||
/**
|
||||
* Get the client IP address.
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function ip()
|
||||
{
|
||||
@@ -298,7 +300,7 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
|
||||
* Merge new input into the current request's input array.
|
||||
*
|
||||
* @param array $input
|
||||
* @return \Illuminate\Http\Request
|
||||
* @return $this
|
||||
*/
|
||||
public function merge(array $input)
|
||||
{
|
||||
@@ -311,7 +313,7 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
|
||||
* Replace the input for the current request.
|
||||
*
|
||||
* @param array $input
|
||||
* @return \Illuminate\Http\Request
|
||||
* @return $this
|
||||
*/
|
||||
public function replace(array $input)
|
||||
{
|
||||
@@ -393,6 +395,8 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
|
||||
$from->getContent()
|
||||
);
|
||||
|
||||
$request->headers->replace($from->headers->all());
|
||||
|
||||
$request->setJson($from->json());
|
||||
|
||||
if ($session = $from->getSession()) {
|
||||
@@ -410,7 +414,7 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
|
||||
* Create an Illuminate request from a Symfony instance.
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @return \Illuminate\Http\Request
|
||||
* @return static
|
||||
*/
|
||||
public static function createFromBase(SymfonyRequest $request)
|
||||
{
|
||||
@@ -420,16 +424,18 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
|
||||
|
||||
$content = $request->content;
|
||||
|
||||
$request = (new static)->duplicate(
|
||||
$newRequest = (new static)->duplicate(
|
||||
$request->query->all(), $request->request->all(), $request->attributes->all(),
|
||||
$request->cookies->all(), $request->files->all(), $request->server->all()
|
||||
);
|
||||
|
||||
$request->content = $content;
|
||||
$newRequest->headers->replace($request->headers->all());
|
||||
|
||||
$request->request = $request->getInputSource();
|
||||
$newRequest->content = $content;
|
||||
|
||||
return $request;
|
||||
$newRequest->request = $newRequest->getInputSource();
|
||||
|
||||
return $newRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+17
-10
@@ -16,8 +16,6 @@ trait ConditionallyLoadsAttributes
|
||||
{
|
||||
$index = -1;
|
||||
|
||||
$numericKeys = array_values($data) === $data;
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$index++;
|
||||
|
||||
@@ -28,7 +26,10 @@ trait ConditionallyLoadsAttributes
|
||||
}
|
||||
|
||||
if (is_numeric($key) && $value instanceof MergeValue) {
|
||||
return $this->mergeData($data, $index, $this->filter($value->data), $numericKeys);
|
||||
return $this->mergeData(
|
||||
$data, $index, $this->filter($value->data),
|
||||
array_values($value->data) === $value->data
|
||||
);
|
||||
}
|
||||
|
||||
if ($value instanceof self && is_null($value->resource)) {
|
||||
@@ -36,7 +37,7 @@ trait ConditionallyLoadsAttributes
|
||||
}
|
||||
}
|
||||
|
||||
return $this->removeMissingValues($data, $numericKeys);
|
||||
return $this->removeMissingValues($data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +55,7 @@ trait ConditionallyLoadsAttributes
|
||||
return $this->removeMissingValues(array_merge(
|
||||
array_merge(array_slice($data, 0, $index, true), $merge),
|
||||
$this->filter(array_values(array_slice($data, $index + 1, null, true)))
|
||||
), $numericKeys);
|
||||
));
|
||||
}
|
||||
|
||||
return $this->removeMissingValues(array_slice($data, 0, $index, true) +
|
||||
@@ -66,22 +67,28 @@ trait ConditionallyLoadsAttributes
|
||||
* Remove the missing values from the filtered data.
|
||||
*
|
||||
* @param array $data
|
||||
* @param bool $numericKeys
|
||||
* @return array
|
||||
*/
|
||||
protected function removeMissingValues($data, $numericKeys = false)
|
||||
protected function removeMissingValues($data)
|
||||
{
|
||||
$numericKeys = true;
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
if (($value instanceof PotentiallyMissing && $value->isMissing()) ||
|
||||
($value instanceof self &&
|
||||
$value->resource instanceof PotentiallyMissing &&
|
||||
$value->isMissing())) {
|
||||
unset($data[$key]);
|
||||
} else {
|
||||
$numericKeys = $numericKeys && is_numeric($key);
|
||||
}
|
||||
}
|
||||
|
||||
return ! empty($data) && is_numeric(array_keys($data)[0])
|
||||
? array_values($data) : $data;
|
||||
if (property_exists($this, 'preserveKeys') && $this->preserveKeys === true) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
return $numericKeys ? array_values($data) : $data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,7 +167,7 @@ trait ConditionallyLoadsAttributes
|
||||
}
|
||||
|
||||
if ($this->resource->{$relationship} === null) {
|
||||
return null;
|
||||
return;
|
||||
}
|
||||
|
||||
return value($value);
|
||||
|
||||
+5
-1
@@ -75,7 +75,11 @@ class JsonResource implements ArrayAccess, JsonSerializable, Responsable, UrlRou
|
||||
*/
|
||||
public static function collection($resource)
|
||||
{
|
||||
return new AnonymousResourceCollection($resource, get_called_class());
|
||||
return tap(new AnonymousResourceCollection($resource, static::class), function ($collection) {
|
||||
if (property_exists(static::class, 'preserveKeys')) {
|
||||
$collection->preserveKeys = (new static([]))->preserveKeys === true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@ class MergeValue
|
||||
/**
|
||||
* Create new merge value instance.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection|array $data
|
||||
* @param \Illuminate\Support\Collection|\JsonSerializable|array $data
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($data)
|
||||
|
||||
@@ -116,6 +116,16 @@ trait ResponseTrait
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the callback of the response.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCallback()
|
||||
{
|
||||
return $this->callback ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the exception to attach to the response.
|
||||
*
|
||||
|
||||
@@ -103,6 +103,16 @@ class UploadedFile extends SymfonyUploadedFile
|
||||
return file_get_contents($this->getPathname());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file's extension supplied by the client.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function clientExtension()
|
||||
{
|
||||
return $this->guessClientExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new file instance from a base instance.
|
||||
*
|
||||
|
||||
+6
-5
@@ -15,10 +15,11 @@
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.1.3",
|
||||
"illuminate/session": "5.7.*",
|
||||
"illuminate/support": "5.7.*",
|
||||
"symfony/http-foundation": "^4.1",
|
||||
"symfony/http-kernel": "^4.1"
|
||||
"ext-json": "*",
|
||||
"illuminate/session": "5.8.*",
|
||||
"illuminate/support": "5.8.*",
|
||||
"symfony/http-foundation": "^4.2",
|
||||
"symfony/http-kernel": "^4.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -27,7 +28,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "5.7-dev"
|
||||
"dev-master": "5.8-dev"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
|
||||
Reference in New Issue
Block a user