Skip to content

Commit

Permalink
Feat:add method custom sign name to config
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-fathi committed Nov 2, 2024
1 parent ce2f8bd commit 2704213
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/QueryFilter/Queries/Eloquent/WhereCustom.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
*/
class WhereCustom extends BaseClause
{
/**
*
*/
public const METHOD_SIGN = "filterCustom";

/**
* @param $query
*
Expand All @@ -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;
}
}
8 changes: 7 additions & 1 deletion src/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
];

0 comments on commit 2704213

Please sign in to comment.