From 270421372ffcaaccdd668b26890fc11ffe3232ff Mon Sep 17 00:00:00 2001 From: mehdi-fathi Date: Sat, 2 Nov 2024 18:46:58 +0330 Subject: [PATCH] Feat:add method custom sign name to config --- src/QueryFilter/Queries/Eloquent/WhereCustom.php | 9 +++------ src/config/config.php | 8 +++++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/QueryFilter/Queries/Eloquent/WhereCustom.php b/src/QueryFilter/Queries/Eloquent/WhereCustom.php index 0b82809..f0ad240 100644 --- a/src/QueryFilter/Queries/Eloquent/WhereCustom.php +++ b/src/QueryFilter/Queries/Eloquent/WhereCustom.php @@ -10,11 +10,6 @@ */ class WhereCustom extends BaseClause { - /** - * - */ - public const METHOD_SIGN = "filterCustom"; - /** * @param $query * @@ -32,8 +27,10 @@ public function apply($query) */ public static function getMethod($filter): string { + $custom_method_sign = config('eloquentFilter.custom_method_sign'); + $filter = ucfirst($filter); - $method = self::METHOD_SIGN . $filter; + $method = $custom_method_sign . $filter; return $method; } } diff --git a/src/config/config.php b/src/config/config.php index 3e75300..24db945 100644 --- a/src/config/config.php +++ b/src/config/config.php @@ -48,8 +48,14 @@ 'request_salt' => function () { return 1234; }, + /* * Cast sign method is prefix name method for change data before filtering. */ - 'cast_method_sign' => 'filterSet' + 'cast_method_sign' => 'filterSet', + + /* + * custom sign method is prefix name method for custom methods in models. + */ + 'custom_method_sign' => 'filterCustom' ];