package updates

This commit is contained in:
2018-12-19 23:27:43 -06:00
parent aa1da4d4fb
commit 1ffd21369f
1181 changed files with 51194 additions and 11046 deletions
@@ -15,7 +15,7 @@ trait InteractsWithInput
*
* @param string $key
* @param string|array|null $default
* @return string|array
* @return string|array|null
*/
public function server($key = null, $default = null)
{
@@ -38,7 +38,7 @@ trait InteractsWithInput
*
* @param string $key
* @param string|array|null $default
* @return string|array
* @return string|array|null
*/
public function header($key = null, $default = null)
{
@@ -257,7 +257,7 @@ trait InteractsWithInput
*
* @param string $key
* @param string|array|null $default
* @return string|array
* @return string|array|null
*/
public function query($key = null, $default = null)
{
@@ -270,7 +270,7 @@ trait InteractsWithInput
* @param string $key
* @param string|array|null $default
*
* @return string|array
* @return string|array|null
*/
public function post($key = null, $default = null)
{
@@ -293,7 +293,7 @@ trait InteractsWithInput
*
* @param string $key
* @param string|array|null $default
* @return string|array
* @return string|array|null
*/
public function cookie($key = null, $default = null)
{
@@ -383,7 +383,7 @@ trait InteractsWithInput
* @param string $source
* @param string $key
* @param string|array|null $default
* @return string|array
* @return string|array|null
*/
protected function retrieveItem($source, $key, $default)
{
@@ -57,6 +57,10 @@ trait FileHelpers
$hash = $this->hashName ?: $this->hashName = Str::random(40);
return $path.$hash.'.'.$this->guessExtension();
if ($extension = $this->guessExtension()) {
$extension = '.'.$extension;
}
return $path.$hash.$extension;
}
}
+5 -5
View File
@@ -108,7 +108,7 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
{
$query = $this->getQueryString();
$question = $this->getBaseUrl().$this->getPathInfo() == '/' ? '/?' : '?';
$question = $this->getBaseUrl().$this->getPathInfo() === '/' ? '/?' : '?';
return $query ? $this->url().$question.$query : $this->url();
}
@@ -121,7 +121,7 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
*/
public function fullUrlWithQuery(array $query)
{
$question = $this->getBaseUrl().$this->getPathInfo() == '/' ? '/?' : '?';
$question = $this->getBaseUrl().$this->getPathInfo() === '/' ? '/?' : '?';
return count($this->query()) > 0
? $this->url().$question.Arr::query(array_merge($this->query(), $query))
@@ -179,7 +179,7 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
/**
* Determine if the current request URI matches a pattern.
*
* @param dynamic $patterns
* @param mixed ...$patterns
* @return bool
*/
public function is(...$patterns)
@@ -196,7 +196,7 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
/**
* Determine if the route name matches a given pattern.
*
* @param dynamic $patterns
* @param mixed ...$patterns
* @return bool
*/
public function routeIs(...$patterns)
@@ -207,7 +207,7 @@ class Request extends SymfonyRequest implements Arrayable, ArrayAccess
/**
* Determine if the current request URL and query string matches a pattern.
*
* @param dynamic $patterns
* @param mixed ...$patterns
* @return bool
*/
public function fullUrlIs(...$patterns)
@@ -4,7 +4,6 @@ namespace Illuminate\Http\Resources\Json;
use ArrayAccess;
use JsonSerializable;
use Illuminate\Support\Collection;
use Illuminate\Container\Container;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Routing\UrlRoutable;
@@ -60,7 +59,7 @@ class JsonResource implements ArrayAccess, JsonSerializable, Responsable, UrlRou
/**
* Create a new resource instance.
*
* @param mixed $parameters
* @param mixed ...$parameters
* @return static
*/
public static function make(...$parameters)
@@ -91,9 +90,7 @@ class JsonResource implements ArrayAccess, JsonSerializable, Responsable, UrlRou
$request = $request ?: Container::getInstance()->make('request')
);
if (is_array($data)) {
$data = $data;
} elseif ($data instanceof Arrayable || $data instanceof Collection) {
if ($data instanceof Arrayable) {
$data = $data->toArray();
} elseif ($data instanceof JsonSerializable) {
$data = $data->jsonSerialize();
@@ -2,11 +2,12 @@
namespace Illuminate\Http\Resources\Json;
use Countable;
use IteratorAggregate;
use Illuminate\Pagination\AbstractPaginator;
use Illuminate\Http\Resources\CollectsResources;
class ResourceCollection extends JsonResource implements IteratorAggregate
class ResourceCollection extends JsonResource implements Countable, IteratorAggregate
{
use CollectsResources;
@@ -37,6 +38,16 @@ class ResourceCollection extends JsonResource implements IteratorAggregate
$this->resource = $this->collectResource($resource);
}
/**
* Return the count of items in the resource collection.
*
* @return int
*/
public function count()
{
return $this->collection->count();
}
/**
* Transform the resource into a JSON array.
*
@@ -41,7 +41,7 @@ class File extends UploadedFile
parent::__construct(
$this->tempFilePath(), $name, $this->getMimeType(),
filesize($this->tempFilePath()), null, true
null, true
);
}