From 539c6b76f410aa7e1781131ac78864784d493f57 Mon Sep 17 00:00:00 2001 From: Austin Williams Date: Sat, 6 Jan 2024 14:06:40 -0500 Subject: [PATCH 1/2] fix typo in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a71ff20..7bd15de 100644 --- a/README.md +++ b/README.md @@ -639,7 +639,7 @@ class UserFilter extends ModelFilter ##### Adding Relation Values To Filter Sometimes, based on the value of a parameter you may need to push data to a relation filter. The `push()` method does just this. -It accepts one argument as an array of key value pairs or to arguments as a key value pair `push($key, $value)`. +It accepts one argument as an array of key value pairs or two arguments as a key value pair `push($key, $value)`. Related models are filtered AFTER all local values have been executed you can use this method in any filter method. This avoids having to query a related table more than once. For Example: From 052d8e68ee62dc5745aa82f7942c964d515cafa2 Mon Sep 17 00:00:00 2001 From: Eric Tucker Date: Sat, 6 Jan 2024 11:12:14 -0800 Subject: [PATCH 2/2] Apply fixes from StyleCI (#195) Co-authored-by: StyleCI Bot --- tests/ModelFilterChildTest.php | 8 ++++---- tests/ModelFilterTest.php | 14 +++++++------- tests/config.php | 10 +++++----- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/ModelFilterChildTest.php b/tests/ModelFilterChildTest.php index ad60588..95afb00 100644 --- a/tests/ModelFilterChildTest.php +++ b/tests/ModelFilterChildTest.php @@ -98,13 +98,13 @@ public function testPaginationWorksOnBelongsToMany() protected function dbSetup() { $config = collect([ - 'database.fetch' => PDO::FETCH_CLASS, - 'database.default' => 'sqlite', + 'database.fetch' => PDO::FETCH_CLASS, + 'database.default' => 'sqlite', 'database.connections' => [ 'sqlite' => [ - 'driver' => 'sqlite', + 'driver' => 'sqlite', 'database' => ':memory:', - 'prefix' => '', + 'prefix' => '', ], ], ]); diff --git a/tests/ModelFilterTest.php b/tests/ModelFilterTest.php index ebf25b5..237dc97 100644 --- a/tests/ModelFilterTest.php +++ b/tests/ModelFilterTest.php @@ -60,13 +60,13 @@ public function testPush() // Test with inserting array $this->filter->push([ 'company_id' => '2', - 'roles' => ['1', '4', '7'], + 'roles' => ['1', '4', '7'], ]); $this->assertEquals($this->filter->input(), [ - 'name' => 'er', + 'name' => 'er', 'company_id' => '2', - 'roles' => ['1', '4', '7'], + 'roles' => ['1', '4', '7'], ]); } @@ -113,12 +113,12 @@ public function testInputMethod() public function testGetFilterMethod() { $input = [ - 'name' => 'name', - 'first_name' => 'firstName', + 'name' => 'name', + 'first_name' => 'firstName', 'first_or_last_name' => 'firstOrLastName', // Test dot-notation works - 'Company.Name' => 'companyName', - 'Company-Name' => 'companyName', + 'Company.Name' => 'companyName', + 'Company-Name' => 'companyName', ]; foreach ($input as $key => $method) { diff --git a/tests/config.php b/tests/config.php index 6ba0047..256eecf 100644 --- a/tests/config.php +++ b/tests/config.php @@ -2,11 +2,11 @@ return [ 'test_input' => [ - 'name' => 'er', - 'last_name' => '', + 'name' => 'er', + 'last_name' => '', 'company_id' => '2', - 'roles' => ['1', '4', '7'], - 'industry' => '', - 'other' => [], + 'roles' => ['1', '4', '7'], + 'industry' => '', + 'other' => [], ], ];