CodeHubOrg / codehub-mentorships

CodeHub Mentorship platform - built with Laravel and React
3 stars 0 forks source link

Katja/convert snake camel #84

Closed katjad closed 4 years ago

katjad commented 4 years ago

Using standard JS casing again

In the controller, the keys of the request are converted into snake case, so they can be written to the database. Laravel has snake() and camel() helper functions that came in handy. Might be still a more elegant way, but it should be okay for now.

Custom requests

Added custom requests for Mentor and MenteeProfile controllers that include the validation

I have built this on the previous PR now (will decline that), so I could do the casing on registration at the same time. So it also includes:

Keeping form values

After failed server-side validation of a form submission, the previously entered values are now displayed in the form. This is through the InertiaServiceProvider, which gets the old values from the session. They are then fed into the Form.tsx component via Inertia's usePage() method.

Registration

This adds the standard registration process via email, and also includes email verification. (I have not restricted any of the existing pages, but have added a component Home/Index.tsx that is only accessible after verification - and indeed currently only says 'Thank you, your account has been verified')

For the email verification on local, I think it is easiest to write the email to the log. Note: In the .env file, you have to rename MAIL_DRIVER to MAIL_MAILER. This variable has to be set to: log.

(The VerificationController overrides methods from the laravel/ui package, because I wanted the link in the email to work event if the user is not logged in. I think I am doing it in a bit of a clunky way, but it works. If anything obvious can be improved, please go ahead, otherwise something to revisit later!)

katjad commented 4 years ago

superseded