Skip to content

Commit 2704213

Browse files
committed
Feat:add method custom sign name to config
1 parent ce2f8bd commit 2704213

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/QueryFilter/Queries/Eloquent/WhereCustom.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
*/
1111
class WhereCustom extends BaseClause
1212
{
13-
/**
14-
*
15-
*/
16-
public const METHOD_SIGN = "filterCustom";
17-
1813
/**
1914
* @param $query
2015
*
@@ -32,8 +27,10 @@ public function apply($query)
3227
*/
3328
public static function getMethod($filter): string
3429
{
30+
$custom_method_sign = config('eloquentFilter.custom_method_sign');
31+
3532
$filter = ucfirst($filter);
36-
$method = self::METHOD_SIGN . $filter;
33+
$method = $custom_method_sign . $filter;
3734
return $method;
3835
}
3936
}

src/config/config.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,14 @@
4848
'request_salt' => function () {
4949
return 1234;
5050
},
51+
5152
/*
5253
* Cast sign method is prefix name method for change data before filtering.
5354
*/
54-
'cast_method_sign' => 'filterSet'
55+
'cast_method_sign' => 'filterSet',
56+
57+
/*
58+
* custom sign method is prefix name method for custom methods in models.
59+
*/
60+
'custom_method_sign' => 'filterCustom'
5561
];

0 commit comments

Comments
 (0)