/** * Inject the models. * @param User $user */ public function __construct(User $user) { parent::__construct(); $this->user = $user; $this->name = 'users'; $this->modelName = 'User'; $this->singleName = 'user'; $this->validationRules = ['username' => 'required|unique:users', 'email' => 'required|email', 'password' => 'required|between:4,11|confirmed', 'first_name' => 'required|max:40', 'last_name' => 'required|max:40']; $this->validationMessages = ['email' => 'Please enter your email address', 'email.email' => 'Please enter a valid email address']; $this->dataTableColumns = ['id', 'username']; }
/** * {@inheritDoc} */ protected function getMessages($type, $name = '') { $messages = parent::getMessages($type, $name); // Don't show the match info on the successful create/edit message foreach ($messages as &$action) { foreach ($action as &$status) { if (isset($status['named'])) { $status['named'] = $status['unnamed']; } } } return $messages; }
protected function canCreate($player) { if ($player->getTeam()->isValid()) { throw new ForbiddenException("You need to abandon your current team before you can create a new one"); } return parent::canCreate($player); }