Window Sessions

Window session files are files which contain session naming pattern which are stored within the window/Sessions directory. These files are used to define session key names and the name is later imported into frame files which can be shared to routes. In most cases, one session file is needed within the application. However, when certain situation arises for the need of a different session file, then the session files comes into play. For example, a session file can help to separate an admin data from a user data if the admin data is stored under a different session key. Consider the example below where we have three files:
1a. window/Sessions/UserSession.php
  <?php 
  
  new Session('user', 'usercookie');


2a. window/Sessions/AdminSession.php
  <?php 
  
  new Session('admin', 'admincookie');


1b. window/Frames/UserFrame.php
  <?php 

  namespace spoova/mi/windows/Frames;

  use Window;
  use User;

  session('usersession')

  class UserFrame extends Window {
    
    function __construct() {

        vdump( User::config('SESSION_NAME') ); //session

    }
    
  }

2b. window/Frames/AdminFrame.php
  <?php 

  namespace spoova/mi/windows/Frames;

  use Window;
  use User;

  session('adminsession')

  class AdminFrame extends Window {
    
    function __construct() {

        vdump( User::config("SESSION_NAME") ); //admin

    }
    
  }

In the example above, we have two session within the window/Sessions/ directory. Within each session file in "1a" and "2a" above, we defined two different session keys "user" and "admin" in which relative session data are expected to be stored. Once the key is stored, we can then import the session files into any frame file using the session() function which was built to load session files into window files by calling the session file name. In the example above, the Userframe class will connect to the UserSession file while the class AdminFrame will connect to the AdminSession file. By defining the session() at the top of the class, it ensures that when we call the session is always added and not overridden from any method. However, if we are sure that the super() of window or in this case "frame" files will not be overridden, then we can declare the session within a the super() method which is usually being called at the start of any route. An example is shown below:
2b. window/Frames/AdminFrame.php
  <?php 

  namespace spoova/mi/windows/Frames;

  use Window;
  use User;

  class AdminFrame extends Window {
    
    function __construct() {

       vdump( User::config('SESSION_NAME') ); //admin

    }

    static function super() {
        
        session('adminsession');

    }
    
  }

in the example above, the AdminFrame file calls the AdminSession file using the global super() method. Once we declare the session keys, we can then extends the session frame files to routes. The children route of the relative session frames will only have access to their respective parent session keys. This makes it easier to deal with session data and helps to distinguish between one session from another.