This repository was archived by the owner on May 14, 2020. It is now read-only.
forked from B-Galati/gh-archive-keyword
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
367e656
commit e5e2749
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace App\Http\Requests; | ||
|
||
use Illuminate\Foundation\Http\FormRequest; | ||
use Carbon\Carbon; | ||
|
||
final class SearchRequest extends FormRequest | ||
{ | ||
|
||
/** | ||
* Determine if the user is authorized to make this request. | ||
* | ||
* @return bool | ||
*/ | ||
public function authorize(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function getSearchTerm(): string | ||
{ | ||
return $this->query->get('searchTerm', ''); | ||
} | ||
|
||
public function getSearchDate(): Carbon | ||
{ | ||
return Carbon::createFromFormat('!Y-m-d', $this->query->get('searchDate')); | ||
} | ||
|
||
/** | ||
* Get the validation rules that apply to the request. | ||
* | ||
* @return array<string,array> | ||
*/ | ||
public function rules(): array | ||
{ | ||
return [ | ||
'searchTerm' => [ | ||
'string', | ||
'sometimes', | ||
], | ||
'searchDate' => [ | ||
'string', | ||
'date:Y-m-d', | ||
'required', | ||
] | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
<?php | ||
|
||
use App\Http\Controllers\ApiDataController; | ||
use Illuminate\Support\Facades\Route; | ||
|
||
Route::get('/search/stats', [ApiDataController::class, 'getCommitStatsBySearchQueryAndDate']); |