mirror of
https://github.com/Kovah/LinkAce.git
synced 2025-02-06 08:18:27 +01:00
Allow search of broken links only
This commit is contained in:
parent
52e1c5f09f
commit
6458ebec71
@ -29,9 +29,10 @@ class SearchRequest extends FormRequest
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'query' => 'bail|required_without_all:only_lists,only_tags',
|
'query' => 'bail|required_without_all:only_lists,only_tags,broken_only',
|
||||||
'only_lists' => 'bail|required_without_all:query,only_tags',
|
'only_lists' => 'bail|required_without_all:query,only_tags,broken_only',
|
||||||
'only_tags' => 'bail|required_without_all:query,only_lists',
|
'only_tags' => 'bail|required_without_all:query,only_lists,broken_only',
|
||||||
|
'broken_only' => 'bail|required_without_all:query,only_lists,only_tags',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,8 +45,9 @@ class SearchRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'query.required_without_all' => trans('search.validation_query_missing'),
|
'query.required_without_all' => trans('search.validation_query_missing'),
|
||||||
'only_lists.required_without_all' => trans('search.validation_lists_missing'),
|
'only_lists.required_without_all' => trans('search.validation_query_missing'),
|
||||||
'only_tags.required_without_all' => trans('search.validation_tags_missing'),
|
'only_tags.required_without_all' => trans('search.validation_query_missing'),
|
||||||
|
'broken_only.required_without_all' => trans('search.validation_query_missing'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,5 @@ return [
|
|||||||
|
|
||||||
'no_results' => 'No results found.',
|
'no_results' => 'No results found.',
|
||||||
|
|
||||||
'validation_query_missing' => 'A search query must be present if no lists or tags were provided.',
|
'validation_query_missing' => 'You must either enter a search query, or select a list, a tag or enable searching for broken links.',
|
||||||
'validation_lists_missing' => 'A list must be present if no query or some tags were provided.',
|
|
||||||
'validation_tags_missing' => 'A tag must be present if no query or some lists were provided.',
|
|
||||||
];
|
];
|
||||||
|
@ -21,11 +21,13 @@ class SearchLinksTest extends ApiTestCase
|
|||||||
public function testWithoutQuery(): void
|
public function testWithoutQuery(): void
|
||||||
{
|
{
|
||||||
$response = $this->getJsonAuthorized('api/v1/search/links');
|
$response = $this->getJsonAuthorized('api/v1/search/links');
|
||||||
|
$msg = 'You must either enter a search query, or select a list, a tag or enable searching for broken links.';
|
||||||
|
|
||||||
$response->assertJsonValidationErrors([
|
$response->assertJsonValidationErrors([
|
||||||
'query' => 'A search query must be present if no lists or tags were provided.',
|
'query' => $msg,
|
||||||
'only_lists' => 'A list must be present if no query or some tags were provided.',
|
'only_lists' => $msg,
|
||||||
'only_tags' => 'A tag must be present if no query or some lists were provided.',
|
'only_tags' => $msg,
|
||||||
|
'broken_only' => $msg,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user