123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App\Http\Requests;
- use App\User;
- use Illuminate\Foundation\Http\FormRequest;
- class RegistrationForm extends FormRequest
- {
- /**
- * Determine if the user is authorized to make this request.
- *
- * @return bool
- */
- public function authorize()
- {
- return true;
- }
- /**
- * Custom code, not part of standard forms/requests.
- *
- * @return User
- */
- public function persist(): User
- {
- $user = User::create($this->only(['name', 'email', 'password']));
- return $user;
- }
- /**
- * Get the validation rules that apply to the request.
- *
- * @return array
- */
- public function rules()
- {
- return [
- 'name' => 'required',
- 'email' => 'required|email',
- // "confirmed" uses <field>_confirmation.
- 'password' => 'required|confirmed',
- ];
- }
- }
|