Last active
June 17, 2020 08:24
-
-
Save elizov/93692483bf8bc43ad90c9b415024335a to your computer and use it in GitHub Desktop.
Laravel custom validation rules for videos. https://medium.com/@elizov/laravel-custom-validation-rules-for-videos-89cbc90c9d94
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
<?php | |
namespace App\Http\Requests; | |
use App\Rules\MaxVideoBitRate; | |
use Illuminate\Foundation\Http\FormRequest; | |
class VideoUploadRequest 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 [ | |
'video' => [ | |
'bail', | |
'mimetypes:video/*', | |
new MaxVideoBitRate(12000000), | |
], | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment