App\Http\Controllers\User\UserController::updateDisplayName PHP Method

updateDisplayName() public method

update DisplayName
public updateDisplayName ( Illuminate\Http\Request $request ) : Xpressengine\Presenter\RendererInterface
$request Illuminate\Http\Request
return Xpressengine\Presenter\RendererInterface
    public function updateDisplayName(Request $request)
    {
        $displayName = $request->get('name');
        $displayName = str_replace('  ', ' ', trim($displayName));
        $user = $this->user;
        XeDB::beginTransaction();
        try {
            $user = $this->handler->update($user, compact('displayName'));
        } catch (\Exception $e) {
            XeDB::rollback();
            throw $e;
        }
        XeDB::commit();
        return XePresenter::makeApi(['type' => 'success', 'message' => 'success', 'displayName' => $displayName]);
    }