Update InvitationsController.php

Validation and functionality.