diff --git a/app/Services/Filter.php b/app/Services/Filter.php index cc60c5e1..51fe6470 100644 --- a/app/Services/Filter.php +++ b/app/Services/Filter.php @@ -27,7 +27,7 @@ class Filter $listeners = $this->getListeners($hook); if ($listeners->isNotEmpty()) { return $this->listeners[$hook] - ->sortByDesc('priority') + ->sortBy('priority') ->reduce(function ($carry, $item) use ($args) { return call_user_func($item['callback'], $carry, ...$args); }, $init); diff --git a/tests/ServicesTest/FilterTest.php b/tests/ServicesTest/FilterTest.php index 1a6335ee..17c697a5 100644 --- a/tests/ServicesTest/FilterTest.php +++ b/tests/ServicesTest/FilterTest.php @@ -29,7 +29,7 @@ class FilterTest extends TestCase $filter->add('hook', function ($value) { return $value.'_high'; }, 30); - $this->assertEquals('value_high_medium_low', $filter->apply('hook', 'value', ['add'])); + $this->assertEquals('value_low_medium_high', $filter->apply('hook', 'value', ['add'])); } public function testRemove()