public function onLogout()
    {
        $user = Auth::getUser();

        Auth::logout();

        if ($user) {
            Event::fire('rainlab.user.logout', [$user]);
        }

        $url = post('redirect', Request::fullUrl());

        Flash::success(Lang::get('rainlab.user::lang.session.logout'));

        return Redirect::to($url);
    }
public function onLogout()
    {
        $user = Auth::getUser();

        Auth::logout();

        if ($user) {
            Event::fire('rainlab.user.logout', [$user]);
        }

        $url = post('redirect', Request::fullUrl());

        Flash::success(Lang::get('rainlab.user::lang.session.logout'));

        return Redirect::to($url);
    }
public function onLogout ( ) { $ user = Auth :: getUser ( ) ; Auth :: logout ( ) ; if ( $ user ) { Event :: fire ( 'rainlab.user.logout' , [ $ user ] ) ; } $ url = post ( 'redirect' , Request :: fullUrl ( ) ) ; Flash :: success ( Lang :: get ( 'rainlab.user::lang.session.logout' ) ) ; return Redirect :: to ( $ url ) ; }
Log out the user

Usage:
<a data-request="onLogout">Sign out</a>

With the optional redirect parameter:
<a data-request="onLogout" data-request-data="redirect: '/good-bye'">Sign out</a>
Log out the user