Request::hasSession PHP Method

hasSession() public static method

This method does not give any information about the state of the session object, like whether the session is started or not. It is just a way to check if this Request is associated with a Session instance.
public static hasSession ( ) : boolean
return boolean true when the Request contains a Session object, false otherwise
        public static function hasSession()
        {
            //Method inherited from \Symfony\Component\HttpFoundation\Request
            return \Illuminate\Http\Request::hasSession();
        }

Usage Example

Example #1
0
 function getValue()
 {
     if ($this->useOldValue && \Request::hasSession()) {
         return old($this->name, $this->value);
     } else {
         return $this->value;
     }
 }