mi
command below:
> php mi add:route Home
spoova\mi\Routes
namespace.
The previous format for generating routes is shown below:
<?php
namespace \spoova\mi\Routes;
use Window;
class Home {
function __construct() {
self::call($this, [
window(':') => 'root'
]);
}
function root() {
// self::load('home', fn() => compile() );
}
}
window(':')
was used to load the current root url while the root()
is the default
method of the Home
route. In the new update, the window()
function has been replaced with
lastUrl()
which works better for all Routes. Also, the default root()
method is now replaced with the current class name.
This is shown below:
<?php
namespace spoova\mi\Routes;
use Window;
class Home {
function __construct() {
self::call($this, [
lastUrl() => 'root'
]);
}
function home() {
// self::load('home', fn() => compile() );
}
}
Routes
has been
introduced to the framework. This class does not currently offer any extended feature, in future updates, generated route files
will inherit from the Route
class rather than directly from the Window
root class. This will help in localizing methods specific to routes from other window methods and will also make it easier to differentiate
route files from other window files like frames. A similar Frames
parent class will be introduced for frame files.