Function : lastCall

This function returns the last called url of a window shutter. When working with shutters, it is usually a difficult process to track window urls. The lastCall() function however, makes this process easy by connecting a parent route to its child routes even if they are not within the same class.

Assuming we have a sample route controller:
sample route: Home
  <?php 

  ... 

  use Window;
  use spoova/mi/windows/Routes/HomeUser;

  Home extends Window { 


    function __construct() {

      self::call($this, 
      
        [
         'home/user' => 'win:Routes/HomeUser',
         'home/dashboard' => 'dashboard',
        ]

      );

    }

    function dashboard() : array {

      echo lastCall(); // home/dashboard

    }


  }
                  
sample route: HomeUser
  <?php 

  ... 

  use Window;
  use spoova/mi/windows/Routes/HomeUser;

  Home extends Window { 


    function __construct() {

      echo lastCall(); // home/user 

    }


  }
                  
In the first class, if the url "home/user" was visited, the dashboard() method is called. However, if the home/user was called, then this will trigger a new class Home/User. While we can easily guess the last url called for "home/user" because the method called is within the same class. This may not be easy for the external class HomeUser called. The lastCall() will however, make it easy to fetch the incoming url as long as a shutter method was used to trigger the class.

Binding Paths

Just like the window() function, we can also bind paths to the lastCall() function. However, this function will not convert dots to slashes.

 lastCall('new/path'); //append "new/path" to previous path