RainLab\User\Components\Session::onRun PHP Method

onRun() public method

Executed when this component is bound to a page or layout.
public onRun ( )
    public function onRun()
    {
        $redirectUrl = $this->controller->pageUrl($this->property('redirect'));
        $allowedGroup = $this->property('security', self::ALLOW_ALL);
        $isAuthenticated = Auth::check();
        if (!$isAuthenticated && $allowedGroup == self::ALLOW_USER) {
            return Redirect::guest($redirectUrl);
        } elseif ($isAuthenticated && $allowedGroup == self::ALLOW_GUEST) {
            return Redirect::guest($redirectUrl);
        }
        $this->page['user'] = $this->user();
    }

Usage Example

 /**
  * Executed when this component is bound to a page or layout.
  */
 public function onRun()
 {
     $this->appId = GraphAPI::instance()->appId;
     $this->redirectLogin = $this->property('redirectLogin') ? $this->controller->pageUrl($this->property('redirectLogin')) : URL::previous();
     $this->redirectSignup = $this->property('redirectSignup') ? $this->controller->pageUrl($this->property('redirectSignup')) : URL::previous();
     return parent::onRun();
 }
All Usage Examples Of RainLab\User\Components\Session::onRun