public function createuser(User $user) { $constants = new AppConstants(); if ($this->isUserExist($user->user_email)) { $result = $constants->USER_ALREADY_EXISTS_STATUS(); } else { if ($user->save()) { $result = $constants->USER_INSERT_SUCCESS_STATUS(); } else { $result = $constants->USER_INSERT_FAILURE_STATUS(); } } return $result; }