Skip to content

remove factory property #39313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 93 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
8f2b06b
Add new lost connection message to DetectsLostConnections (#39028)
marcvdm Sep 29, 2021
4de8ef4
[8.x] Mail empty address handling (#39035)
Synchro Sep 29, 2021
9eb56d9
[8.x] Fix haveibeenpwnd failures (#39038)
driesvints Sep 29, 2021
665b25b
Store artifacts for builds (#39037)
driesvints Sep 29, 2021
b5a70e2
Fix build
driesvints Sep 30, 2021
8918a9d
Fix LazyCollection#unique() double enumeration (#39041)
JosephSilber Sep 30, 2021
568e741
feat: add missing singular `minute()` call (#39050)
owenvoke Oct 1, 2021
3e8f7fa
Add missing methods to App facade docblock (#39073)
adevade Oct 4, 2021
fc19b75
Adds
nunomaduro Oct 5, 2021
f8f524e
Re-enable and fix test (#39090)
driesvints Oct 5, 2021
060960a
[8.x] HTTP client: only allow a single User-Agent header (#39085)
julesjanssen Oct 5, 2021
d3db93e
Merge branch '6.x' into 8.x
driesvints Oct 5, 2021
8f3d280
version
taylorotwell Oct 5, 2021
5e55aa4
version
taylorotwell Oct 5, 2021
9b0a166
Add test for withoutContext (#39094)
lucasmichot Oct 5, 2021
698029e
Refactor prepareHandler (#39093)
lucasmichot Oct 5, 2021
9c36d06
[8.x] Add `reduceMany` to Collections (#39078)
inxilpro Oct 5, 2021
29b6d5f
[6.x] update changelog
TBlindaruk Oct 5, 2021
9107ea6
Merge remote-tracking branch 'upstream/6.x' into 6.x
TBlindaruk Oct 5, 2021
c775a94
[8.x] update changelog
TBlindaruk Oct 5, 2021
e1089e1
[8.x] update changelog
TBlindaruk Oct 5, 2021
9b85771
Add stringable support for strip_tags() (#39098)
intrepidws Oct 5, 2021
36b403d
Expose the underlying output implementation (#39099)
jhdxr Oct 5, 2021
df0ede9
Apply fixes from StyleCI
taylorotwell Oct 5, 2021
04fc7c2
flush component state when done rendering
taylorotwell Oct 5, 2021
8f732f1
implement consume
taylorotwell Oct 5, 2021
0909981
Revert "implement consume"
taylorotwell Oct 5, 2021
8a565fa
[8.x] Declare that abort(), dd() and kill() never return (#39108)
caugner Oct 6, 2021
5e56f8a
Ensure namespaces match the project structure. (#39107)
lucasmichot Oct 6, 2021
8b2cdb1
[8.x] Adding `lang_path` helper function (#39103)
rrpadilla Oct 6, 2021
ddb5fef
[8.x] Consume Blade Directive (#39100)
inxilpro Oct 6, 2021
ba01183
Merge branch '8.x' of github.com:laravel/framework into 8.x
taylorotwell Oct 6, 2021
f0acffe
Fixed a typo in the author's name in Inspiring quotes (#39117)
NinoSkopac Oct 6, 2021
544ad97
Merge branch '8.x' of github.com:laravel/framework into 8.x
taylorotwell Oct 6, 2021
bc92a96
[8.x] Add nested relationships to whereRelation function (#39064)
josemariagomez Oct 6, 2021
51e9106
Apply fixes from StyleCI
taylorotwell Oct 6, 2021
1557042
[8.x] Revert "[8.x] Add nested relationships to whereRelation functio…
JurianArie Oct 7, 2021
a683198
[8.x] Fix route groups with no prefix on PHP 8.1 (#39115)
GuardsmanPanda Oct 7, 2021
e5bfb69
Ignore tablespaces in dump (#39126)
ethanclevenger91 Oct 7, 2021
87c6fba
Merge branch '8.x' of github.com:laravel/framework into 8.x
taylorotwell Oct 7, 2021
65702d2
[8.x] New JobRetrying event dispatched (#39097)
masterix21 Oct 7, 2021
2b95dd9
Update SchemaState Process to remove timeout (#39139)
amanpatel Oct 7, 2021
1e4c57c
[8.x] Add throwIf method in Client Response (#39148)
ahmadmayahi Oct 8, 2021
02bc7ad
[8.x] Fix code locating Bearer token in InteractsWithInput (#39150)
adi64 Oct 8, 2021
555617e
Return command success enum instead of 0 for clarity to newer devs (#…
fylzero Oct 8, 2021
d41ff7e
Remove useless methods overrides (#39164)
lucasmichot Oct 11, 2021
758565c
[8.x] Add hasAny() Method to Collections (#39155)
intrepidws Oct 11, 2021
c2c0ac4
Merge branch '8.x' of github.com:laravel/framework into 8.x
taylorotwell Oct 12, 2021
3337c02
version
taylorotwell Oct 12, 2021
e38ae60
[8.x] update changelog
TBlindaruk Oct 12, 2021
9eadb7f
Allow queueing application and service provider callbacks while callb…
Oct 12, 2021
63dab48
formatting
taylorotwell Oct 13, 2021
2bad6a3
[8.x] Add ability to validate one of multiple date formats (#39170)
stevebauman Oct 13, 2021
6442130
[8.x] Re-add update from support for PostgreSQL (#39151)
driesvints Oct 13, 2021
a01e9ed
add alias method
taylorotwell Oct 13, 2021
76872a7
Added assertRedirectRegex
Livijn Oct 13, 2021
02c5dc5
[8.x] Add gate policy callback (#39185)
cbl Oct 14, 2021
a738e0e
Deprecate `reduceMany` in favor of `reduceSpread` (#39201)
JosephSilber Oct 14, 2021
9110b23
[8.x] Allow Remember Me cookie time to be overriden (#39186)
JamesFreeman Oct 14, 2021
8587185
[8.x] Adds `--test` and `--pest` options to various `make` commands (…
lukeraymonddowning Oct 14, 2021
9cffd34
[6.x] Add new lost connection message to `DetectsLostConnections` for…
Oct 15, 2021
068c752
Add assertions for notifications sent on-demand (#39203)
roberto-aguilar Oct 15, 2021
b8a0877
[8.x] Fix HasOneOfMany with callback issue (#39187)
bastien-phi Oct 15, 2021
72aeac2
[8.x] Subset in request's collect (#39191)
iraldoad Oct 15, 2021
06ac29b
Changed assertRedirectRegex to assertRedirectContains
Livijn Oct 17, 2021
994cf4c
Define the expected exception (#39248)
lucasmichot Oct 18, 2021
ded0d50
No need of FQCN. (#39247)
lucasmichot Oct 18, 2021
da8aff4
Add missing tests imports. (#39246)
lucasmichot Oct 18, 2021
790c4d4
Use expectNotToPerformAssertions. (#39240)
lucasmichot Oct 18, 2021
ff340a6
formatting
taylorotwell Oct 18, 2021
28709b1
Merge branch 'Livijn/8.x' into 8.x
taylorotwell Oct 18, 2021
24a922e
[8.x] Add Conditional trait to Eloquent Factory (#39228)
abenerd Oct 18, 2021
fea2e54
[8.x] Add a way to skip count check but check $callback at the same t…
s3i7h Oct 18, 2021
6791576
[8.x] Add `Str::headline()` (#39174)
stevebauman Oct 18, 2021
52e2376
[8.x] Logs deprecations instead of treating them as exceptions (#39219)
nunomaduro Oct 18, 2021
5067ccf
version
taylorotwell Oct 19, 2021
6db59af
Merge remote-tracking branch 'origin/8.x' into 8.x
taylorotwell Oct 19, 2021
a161262
[8.x] Adds `withoutDeprecationHandling` (#39261)
nunomaduro Oct 19, 2021
69a95de
[8.x] Add method for on-demand log creation
jobyh Oct 19, 2021
2c7260d
added dateTime to doesntNeedCharacterOptions (#39269)
Dakoni4400 Oct 20, 2021
cdb05c5
[8.x] Add `AssertableJson::hasAny` (#39265)
tontonsb Oct 20, 2021
fec8c5d
formatting
taylorotwell Oct 20, 2021
7acb44d
Merge branch 'jobyh/8.x' into 8.x
taylorotwell Oct 20, 2021
41ac7e8
Added Arr::isList() helper (#39277)
PHLAK Oct 20, 2021
dade8df
Revert "[8.x] Add gate policy callback (#39185)" (#39290)
driesvints Oct 21, 2021
5478822
Apply withoutGlobalScope in CanBeOneOfMany subqueries (#39295)
bastien-phi Oct 21, 2021
d11799c
[8.x] Added new assertNothingDispatched method to BusFake (#39286)
carlalexander Oct 21, 2021
b757fe1
version
taylorotwell Oct 21, 2021
024067f
fix translation bug and add test (#39298)
taylorotwell Oct 21, 2021
cca0c5f
Throwable error code can only be an integer (#39280)
lucacri Oct 21, 2021
4b785c6
Fix unique bug (#39302)
taylorotwell Oct 21, 2021
0d911ce
Merge branch '8.x'
driesvints Oct 22, 2021
5ceca2a
Remove model property from base Factory class
driesvints Oct 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ jobs:
AWS_ACCESS_KEY_ID: random_key
AWS_SECRET_ACCESS_KEY: random_secret

- name: Store artifacts
uses: actions/upload-artifact@v2
with:
name: logs
path: |
vendor/orchestra/testbench-core/laravel/storage/logs
!vendor/**/.gitignore

windows_tests:
runs-on: windows-latest

Expand Down Expand Up @@ -137,3 +145,11 @@ jobs:

- name: Execute tests
run: vendor/bin/phpunit --verbose

- name: Store artifacts
uses: actions/upload-artifact@v2
with:
name: logs
path: |
vendor/orchestra/testbench-core/laravel/storage/logs
!vendor/**/.gitignore
4 changes: 4 additions & 0 deletions src/Illuminate/Auth/AuthManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ public function createSessionDriver($name, $config)
$guard->setRequest($this->app->refresh('request', $guard, 'setRequest'));
}

if (isset($config['remember'])) {
$guard->setRememberDuration($config['remember']);
}

return $guard;
}

Expand Down
32 changes: 31 additions & 1 deletion src/Illuminate/Auth/SessionGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ class SessionGuard implements StatefulGuard, SupportsBasicAuth
*/
protected $viaRemember = false;

/**
* The number of minutes that the "remember me" cookie should be valid for.
*
* @var int
*/
protected $rememberDuration = 2628000;

/**
* The session used by the guard.
*
Expand Down Expand Up @@ -532,7 +539,7 @@ protected function queueRecallerCookie(AuthenticatableContract $user)
*/
protected function createRecaller($value)
{
return $this->getCookieJar()->forever($this->getRecallerName(), $value);
return $this->getCookieJar()->make($this->getRecallerName(), $value, $this->getRememberDuration());
}

/**
Expand Down Expand Up @@ -816,6 +823,29 @@ public function viaRemember()
return $this->viaRemember;
}

/**
* Get the number of minutes the remember me cookie should be valid for.
*
* @return int
*/
protected function getRememberDuration()
{
return $this->rememberDuration;
}

/**
* Set the number of minutes the remember me cookie should be valid for.
*
* @param int $minutes
* @return $this
*/
public function setRememberDuration($minutes)
{
$this->rememberDuration = $minutes;

return $this;
}

/**
* Get the cookie creator instance used by the guard.
*
Expand Down
48 changes: 48 additions & 0 deletions src/Illuminate/Bus/UniqueLock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace Illuminate\Bus;

use Illuminate\Contracts\Cache\Repository as Cache;

class UniqueLock
{
/**
* The cache repository implementation.
*
* @var \Illuminate\Contracts\Cache\Repository
*/
protected $cache;

/**
* Create a new unique lock manager instance.
*
* @param \Illuminate\Contracts\Cache\Repository $cache
* @return void
*/
public function __construct(Cache $cache)
{
$this->cache = $cache;
}

/**
* Attempt to acquire a lock for the given job.
*
* @param mixed $job
* @return bool
*/
public function acquire($job)
{
$uniqueId = method_exists($job, 'uniqueId')
? $job->uniqueId()
: ($job->uniqueId ?? '');

$cache = method_exists($job, 'uniqueVia')
? $job->uniqueVia()
: $this->cache;

return (bool) $cache->lock(
$key = 'laravel_unique_job:'.get_class($job).$uniqueId,
$job->uniqueFor ?? 0
)->get();
}
}
13 changes: 13 additions & 0 deletions src/Illuminate/Collections/Arr.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,19 @@ public static function isAssoc(array $array)
return array_keys($keys) !== $keys;
}

/**
* Determines if an array is a list.
*
* An array is a "list" if all array keys are sequential integers starting from 0 with no gaps in between.
*
* @param array $array
* @return bool
*/
public static function isList($array)
{
return ! self::isAssoc($array);
}

/**
* Get a subset of the items from the given array.
*
Expand Down
45 changes: 45 additions & 0 deletions src/Illuminate/Collections/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,29 @@ public function has($key)
return true;
}

/**
* Determine if any of the keys exist in the collection.
*
* @param mixed $key
* @return bool
*/
public function hasAny($key)
{
if ($this->isEmpty()) {
return false;
}

$keys = is_array($key) ? $key : func_get_args();

foreach ($keys as $value) {
if ($this->has($value)) {
return true;
}
}

return false;
}

/**
* Concatenate values of a given key as a string.
*
Expand Down Expand Up @@ -1442,6 +1465,28 @@ public function transform(callable $callback)
return $this;
}

/**
* Return only unique items from the collection array.
*
* @param string|callable|null $key
* @param bool $strict
* @return static
*/
public function unique($key = null, $strict = false)
{
$callback = $this->valueRetriever($key);

$exists = [];

return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) {
if (in_array($id = $callback($item, $key), $exists, $strict)) {
return true;
}

$exists[] = $id;
});
}

/**
* Reset the keys on the underlying array.
*
Expand Down
43 changes: 43 additions & 0 deletions src/Illuminate/Collections/LazyCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,25 @@ public function has($key)
return false;
}

/**
* Determine if any of the keys exist in the collection.
*
* @param mixed $key
* @return bool
*/
public function hasAny($key)
{
$keys = array_flip(is_array($key) ? $key : func_get_args());

foreach ($this as $key => $value) {
if (array_key_exists($key, $keys)) {
return true;
}
}

return false;
}

/**
* Concatenate values of a given key as a string.
*
Expand Down Expand Up @@ -1352,6 +1371,30 @@ public function tapEach(callable $callback)
});
}

/**
* Return only unique items from the collection array.
*
* @param string|callable|null $key
* @param bool $strict
* @return static
*/
public function unique($key = null, $strict = false)
{
$callback = $this->valueRetriever($key);

return new static(function () use ($callback, $strict) {
$exists = [];

foreach ($this as $key => $item) {
if (! in_array($id = $callback($item, $key), $exists, $strict)) {
yield $key => $item;

$exists[] = $id;
}
}
});
}

/**
* Reset the keys on the underlying array.
*
Expand Down
44 changes: 44 additions & 0 deletions src/Illuminate/Collections/Traits/EnumeratesValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use JsonSerializable;
use Symfony\Component\VarDumper\VarDumper;
use Traversable;
use UnexpectedValueException;

/**
* @template TKey of array-key
Expand Down Expand Up @@ -733,6 +734,49 @@ public function reduce(callable $callback, $initial = null)
return $result;
}

/**
* Reduce the collection to multiple aggregate values.
*
* @param callable $callback
* @param mixed ...$initial
* @return array
*
* @deprecated Use "reduceSpread" instead
*
* @throws \UnexpectedValueException
*/
public function reduceMany(callable $callback, ...$initial)
{
return $this->reduceSpread($callback, ...$initial);
}

/**
* Reduce the collection to multiple aggregate values.
*
* @param callable $callback
* @param mixed ...$initial
* @return array
*
* @throws \UnexpectedValueException
*/
public function reduceSpread(callable $callback, ...$initial)
{
$result = $initial;

foreach ($this as $key => $value) {
$result = call_user_func_array($callback, array_merge($result, [$value, $key]));

if (! is_array($result)) {
throw new UnexpectedValueException(sprintf(
"%s::reduceMany expects reducer to return an array, but got a '%s' instead.",
class_basename(static::class), gettype($result)
));
}
}

return $result;
}

/**
* Reduce an associative collection to a single value.
*
Expand Down
44 changes: 44 additions & 0 deletions src/Illuminate/Console/Concerns/CreatesMatchingTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace Illuminate\Console\Concerns;

use Illuminate\Support\Str;
use Symfony\Component\Console\Input\InputOption;

trait CreatesMatchingTest
{
/**
* Add the standard command options for generating matching tests.
*
* @return void
*/
protected function addTestOptions()
{
foreach (['test' => 'PHPUnit', 'pest' => 'Pest'] as $option => $name) {
$this->getDefinition()->addOption(new InputOption(
$option,
null,
InputOption::VALUE_NONE,
"Generate an accompanying {$name} test for the {$this->type}"
));
}
}

/**
* Create the matching test case if requested.
*
* @param string $path
* @return void
*/
protected function handleTestCreation($path)
{
if (! $this->option('test') && ! $this->option('pest')) {
return;
}

$this->call('make:test', [
'name' => Str::of($path)->after($this->laravel['path'])->beforeLast('.php')->append('Test')->replace('\\', '/'),
'--pest' => $this->option('pest'),
]);
}
}
Loading