Improve params.

This commit is contained in:
kj 2020-03-16 22:54:12 -04:00
parent 255ef0a75d
commit b07333f3c8
2 changed files with 10 additions and 3 deletions

View File

@ -13,6 +13,10 @@ class Params {
}
}
public function __isset($index) {
return isset($this->data[$index]);
}
public function __get($index){
return (isset($this->data[$index]) && $this->data[$index] != '') ? $this->data[$index] : null;
}

View File

@ -1,4 +1,5 @@
<?php
namespace Libs;
use Libs\Request;
@ -119,15 +120,17 @@ class Router{
if (isset($router['middleware'])){
$middleware = explode('::',$router['middleware']);
$data = call_user_func_array($middleware, [$router['callback'], $args, $params]);
}else
} else {
$params[] = $args;
$data = call_user_func_array($router['callback'], $params);
$data = call_user_func_array($router['callback'], $params);
}
}else{
if (isset($router['middleware'])){
$middleware = explode('::',$router['middleware']);
$data = call_user_func_array($middleware, [$router['callback'], $args]);
}else
} else {
$data = call_user_func_array($router['callback'], [$args]);
}
}
if (isset($data)){