Permalink
Show file tree
Hide file tree
6 changes: 3 additions & 3 deletions
6
app/Http/Controllers/V1/Admin/Modules/UnzipModuleController.php
6 changes: 3 additions & 3 deletions
6
app/Http/Controllers/V1/Admin/Modules/UploadModuleController.php
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Module upload validation (#857)
- Loading branch information
1 parent
4e7441a
commit 7cde971
Showing
4 changed files
with
83 additions
and
6 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
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,37 @@ | ||
| <?php | ||
|
|
||
| namespace Crater\Http\Requests; | ||
|
|
||
| use Illuminate\Foundation\Http\FormRequest; | ||
|
|
||
| class UnzipUpdateRequest extends FormRequest | ||
| { | ||
| /** | ||
| * Determine if the user is authorized to make this request. | ||
| * | ||
| * @return bool | ||
| */ | ||
| public function authorize() | ||
| { | ||
| return true; | ||
| } | ||
|
|
||
| /** | ||
| * Get the validation rules that apply to the request. | ||
| * | ||
| * @return array | ||
| */ | ||
| public function rules() | ||
| { | ||
| return [ | ||
| 'path' => [ | ||
| 'required', | ||
| 'regex:/^[\.\/\w\-]+$/' | ||
| ], | ||
| 'module' => [ | ||
| 'required', | ||
| 'string' | ||
| ] | ||
| ]; | ||
| } | ||
| } |
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,40 @@ | ||
| <?php | ||
|
|
||
| namespace Crater\Http\Requests; | ||
|
|
||
| use Illuminate\Foundation\Http\FormRequest; | ||
|
|
||
| class UploadModuleRequest extends FormRequest | ||
| { | ||
| /** | ||
| * Determine if the user is authorized to make this request. | ||
| * | ||
| * @return bool | ||
| */ | ||
| public function authorize() | ||
| { | ||
| return true; | ||
| } | ||
|
|
||
| /** | ||
| * Get the validation rules that apply to the request. | ||
| * | ||
| * @return array | ||
| */ | ||
| public function rules() | ||
| { | ||
| return [ | ||
| 'avatar' => [ | ||
| 'required', | ||
| 'file', | ||
| 'mimes:zip', | ||
| 'max:20000' | ||
| ], | ||
| 'module' => [ | ||
| 'required', | ||
| 'string', | ||
| 'max:100' | ||
| ] | ||
| ]; | ||
| } | ||
| } |