diff --git a/README.md b/README.md index 01cac8e..a318175 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ return $orderable->apply($query)->get(); ``` ```sql -select * FROM `users` ORDER BY `name` DESC; +select * from `users` order by `name` desc; ``` > The code will validate the column name before trying to apply `orderBy()` to the query, this would prevent SQL injection especially when column is given by the user. diff --git a/src/Searchable.php b/src/Searchable.php index 1f12dc5..4e07c79 100644 --- a/src/Searchable.php +++ b/src/Searchable.php @@ -61,7 +61,6 @@ public function apply($query) * Build wildcard query filter for field using where or orWhere. * * @param \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder $query - * @param \Laravie\QueryFilter\Value\Field $column * * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder */ @@ -84,7 +83,6 @@ protected function queryOnColumn($query, Value\Field $column, string $likeOperat * Build wildcard query filter for column using where or orWhere. * * @param \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder $query - * @param \Laravie\QueryFilter\Value\Field $column * * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder */ @@ -113,7 +111,6 @@ protected function queryOnColumnUsing( * Build wildcard query filter for JSON column using where or orWhere. * * @param \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder $query - * @param \Laravie\QueryFilter\Value\Field $column * * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder */ diff --git a/src/Taxonomy.php b/src/Taxonomy.php index 7eaa1e1..4ea9e44 100644 --- a/src/Taxonomy.php +++ b/src/Taxonomy.php @@ -80,7 +80,7 @@ protected function matchTaggedConditions($query): void } foreach ($this->rules as $keyword => $callback) { - if (Str::contains($keyword, ':*') || Str::contains($keyword, ':[]')) { + if (\strpos($keyword, ':*') !== false || \strpos($keyword, ':[]') !== false) { [$tag, $type] = \explode(':', $keyword, 2); $results = Arr::where($tagged, static function ($value) use ($tag) { diff --git a/src/Value/Field.php b/src/Value/Field.php index 9ecd561..1889476 100644 --- a/src/Value/Field.php +++ b/src/Value/Field.php @@ -23,7 +23,7 @@ public function validate(): bool */ public function isRelationSelector(): bool { - return Str::contains($this->name, '.'); + return \strpos($this->name, '.') !== false; } /** @@ -31,7 +31,7 @@ public function isRelationSelector(): bool */ public function isJsonPathSelector(): bool { - return Str::contains($this->name, '->'); + return \strpos($this->name, '->') !== false; } /** diff --git a/src/Value/Keywords.php b/src/Value/Keywords.php index e5ab5b5..fe9ec53 100644 --- a/src/Value/Keywords.php +++ b/src/Value/Keywords.php @@ -32,7 +32,7 @@ public function __construct(string $basic, array $tagged) /** * Parse rules from keyword. * - * @return array + * @return static */ public static function parse(string $keyword, array $rules) {