Last active
April 8, 2018 16:28
-
-
Save deleugpn/2c61ae93cbe86cdfaa43fb41209099f3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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\Modules\Administrators\Requests; | |
| use App\Http\Contracts\Baggable; | |
| use App\Http\Requests\BaseFormRequest; | |
| use App\Modules\Administrators\Bags\AdministratorBag; | |
| use Illuminate\Validation\Rule; | |
| class StoreAdministratorRequest extends BaseFormRequest implements Baggable | |
| { | |
| public function rules() | |
| { | |
| return [ | |
| 'name' => 'required|string', | |
| 'email' => ['required', 'email', Rule::unique('administrators', 'email')], | |
| 'password' => 'required|min:6', | |
| 'department' => ['required', 'int', Rule::exists('departments', 'id')], | |
| ]; | |
| } | |
| public function toBag(): AdministratorBag | |
| { | |
| return new AdministratorBag( | |
| $this->validated() | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment