From 6cbe0eb0ea43ba4c512ba9ce2519fa2c09a62a94 Mon Sep 17 00:00:00 2001 From: Ryan Chandler Date: Thu, 4 Mar 2021 14:06:39 +0000 Subject: [PATCH 1/6] [8.x] Add new `VendorTagPublished` event (#36458) * feature: add new VendorTagPublished event * fix: only fire event when something was published * refactor: fire event before erroring in console * revert: move event dispatch into else arm * chore: update comment on $paths * chore: publish to publishable * chore: add missing comment * Update VendorPublishCommand.php * Update VendorTagPublished.php Co-authored-by: Taylor Otwell --- .../Console/VendorPublishCommand.php | 7 +++- .../Foundation/Events/VendorTagPublished.php | 33 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/Illuminate/Foundation/Events/VendorTagPublished.php diff --git a/src/Illuminate/Foundation/Console/VendorPublishCommand.php b/src/Illuminate/Foundation/Console/VendorPublishCommand.php index 17a459e72834..501142f0d63c 100644 --- a/src/Illuminate/Foundation/Console/VendorPublishCommand.php +++ b/src/Illuminate/Foundation/Console/VendorPublishCommand.php @@ -4,6 +4,7 @@ use Illuminate\Console\Command; use Illuminate\Filesystem\Filesystem; +use Illuminate\Foundation\Events\VendorTagPublished; use Illuminate\Support\Arr; use Illuminate\Support\ServiceProvider; use League\Flysystem\Adapter\Local as LocalAdapter; @@ -159,7 +160,9 @@ protected function publishTag($tag) { $published = false; - foreach ($this->pathsToPublish($tag) as $from => $to) { + $pathsToPublish = $this->pathsToPublish($tag); + + foreach ($pathsToPublish as $from => $to) { $this->publishItem($from, $to); $published = true; @@ -167,6 +170,8 @@ protected function publishTag($tag) if ($published === false) { $this->error('Unable to locate publishable resources.'); + } else { + $this->laravel['events']->dispatch(new VendorTagPublished($tag, $pathsToPublish)); } } diff --git a/src/Illuminate/Foundation/Events/VendorTagPublished.php b/src/Illuminate/Foundation/Events/VendorTagPublished.php new file mode 100644 index 000000000000..084c1293fcfd --- /dev/null +++ b/src/Illuminate/Foundation/Events/VendorTagPublished.php @@ -0,0 +1,33 @@ +tag = $tag; + $this->paths = $paths; + } +} From 34418f340f29d7602be2663a761f4911ecf4c5d0 Mon Sep 17 00:00:00 2001 From: Ryan Chandler Date: Thu, 4 Mar 2021 14:09:31 +0000 Subject: [PATCH 2/6] [8.x] Add new `Stringable::test` method (#36462) * feature: add new Stringable::matches method * tests: new Stringable::matches method * refactor: use match instead of matchAll * chore: rename method from matches to test --- src/Illuminate/Support/Stringable.php | 11 +++++++++++ tests/Support/SupportStringableTest.php | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/src/Illuminate/Support/Stringable.php b/src/Illuminate/Support/Stringable.php index ff5f44c5fded..0d544a3987cf 100644 --- a/src/Illuminate/Support/Stringable.php +++ b/src/Illuminate/Support/Stringable.php @@ -365,6 +365,17 @@ public function matchAll($pattern) return collect($matches[1] ?? $matches[0]); } + /** + * Determine if the string matches the given pattern. + * + * @param string $pattern + * @return bool + */ + public function test($pattern) + { + return $this->match($pattern)->isNotEmpty(); + } + /** * Pad both sides of the string with another. * diff --git a/tests/Support/SupportStringableTest.php b/tests/Support/SupportStringableTest.php index 15ab04726cb1..d6c010fd20fd 100644 --- a/tests/Support/SupportStringableTest.php +++ b/tests/Support/SupportStringableTest.php @@ -62,6 +62,14 @@ public function testMatch() $this->assertTrue($stringable->matchAll('/nothing/')->isEmpty()); } + public function testTest() + { + $stringable = $this->stringable('foo bar'); + + $this->assertTrue($stringable->test('/bar/')); + $this->assertTrue($stringable->test('/foo (.*)/')); + } + public function testTrim() { $this->assertSame('foo', (string) $this->stringable(' foo ')->trim()); From ddb0c5e68ec8037ed31738bbfed4ededa3cd39da Mon Sep 17 00:00:00 2001 From: LuttaMustache <45479378+LuttaMustache@users.noreply.github.com> Date: Thu, 4 Mar 2021 21:10:57 +0600 Subject: [PATCH 3/6] multiplatform newline check (#36464) --- src/Illuminate/Foundation/Console/PolicyMakeCommand.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Foundation/Console/PolicyMakeCommand.php b/src/Illuminate/Foundation/Console/PolicyMakeCommand.php index 0fe6964d5940..78873de065ee 100644 --- a/src/Illuminate/Foundation/Console/PolicyMakeCommand.php +++ b/src/Illuminate/Foundation/Console/PolicyMakeCommand.php @@ -131,8 +131,13 @@ protected function replaceModel($stub, $model) array_keys($replace), array_values($replace), $stub ); - return str_replace( - "use {$namespacedModel};\nuse {$namespacedModel};", "use {$namespacedModel};", $stub + return preg_replace( + vsprintf('/use %s;[\r\n]+use %s;/', [ + preg_quote($namespacedModel, '/'), + preg_quote($namespacedModel, '/'), + ]), + "use {$namespacedModel};", + $stub ); } From 26fe23fc6819c20495791e791c97405c38ce4de0 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 4 Mar 2021 09:19:57 -0600 Subject: [PATCH 4/6] Revert "Revert "Revert "[8.x] Fix formatWheres in DatabaseRule (#36441)" (#36452)" (#36453)" (#36465) This reverts commit 018314829ccb70ec20a6fc25fa4bd382d09d6cc0. --- src/Illuminate/Validation/Rules/DatabaseRule.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Illuminate/Validation/Rules/DatabaseRule.php b/src/Illuminate/Validation/Rules/DatabaseRule.php index 88b4d27cd941..b8113b2afadb 100644 --- a/src/Illuminate/Validation/Rules/DatabaseRule.php +++ b/src/Illuminate/Validation/Rules/DatabaseRule.php @@ -196,11 +196,7 @@ public function queryCallbacks() protected function formatWheres() { return collect($this->wheres)->map(function ($where) { - if (is_bool($where['value'])) { - return $where['column'].','.($where['value'] ? 'true' : 'false'); - } else { - return $where['column'].','.'"'.str_replace('"', '""', $where['value']).'"'; - } + return $where['column'].','.'"'.str_replace('"', '""', $where['value']).'"'; })->implode(','); } } From 2aa5c2488d25178ebc097052c7897a0e463ddc35 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 4 Mar 2021 09:22:36 -0600 Subject: [PATCH 5/6] version --- src/Illuminate/Foundation/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index 1e35f20d4f46..45be0dd0b96e 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -33,7 +33,7 @@ class Application extends Container implements ApplicationContract, CachesConfig * * @var string */ - const VERSION = '8.30.1'; + const VERSION = '8.31.0'; /** * The base path for the Laravel installation. From 6bcaec0971b2fb264bdc8629a98606d15d6a5810 Mon Sep 17 00:00:00 2001 From: Jared Lewis Date: Thu, 4 Mar 2021 11:55:21 -0500 Subject: [PATCH 6/6] Update Bootstrap pagination style --- .../resources/views/bootstrap-4.blade.php | 92 +++++++++++++------ 1 file changed, 65 insertions(+), 27 deletions(-) diff --git a/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php b/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php index 63c6f56b59e0..37ef532d7c86 100644 --- a/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php +++ b/src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php @@ -1,46 +1,84 @@ @if ($paginator->hasPages()) -