Skip to content

Commit

Permalink
Atualizando chamada de rotas
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricio-msp committed Jul 7, 2017
1 parent 8c29f03 commit d7c2637
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Routing/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public function get($path = '*', $callback = NULL){
if(is_string($callback)):

$params = explode('@', $callback);
$controller = 'app\\controllers\\' . $params[0] . 'Controller.php';
$controller = 'app\\controllers\\' . $params[0] . 'Controller';
$action = $params[1];

$this->respond('GET', $path, function($request, $response, $app) use ($controller, $action){
$this->respond('GET', $path, function($request, $response, $service) use ($controller, $action){
$controller = new $controller();
$controller->loader($request, $response, $app);
$controller->loader($request, $response, $service);
return $controller->$action();
});
else:
Expand All @@ -43,12 +43,12 @@ public function post($path = '*', $callback = NULL){
if(is_string($callback)):

$params = explode('@', $callback);
$controller = 'app\\controllers\\' . $params[0] . 'Controller.php';
$controller = 'app\\controllers\\' . $params[0] . 'Controller';
$action = $params[1];

$this->respond('POST', $path, function($request, $response, $app) use ($controller, $action){
$this->respond('POST', $path, function($request, $response, $service) use ($controller, $action){
$controller = new $controller();
$controller->loader($request, $response, $app);
$controller->loader($request, $response, $service);
return $controller->$action();
});
else:
Expand All @@ -61,12 +61,12 @@ public function put($path = '*', $callback = NULL){
if(is_string($callback)):

$params = explode('@', $callback);
$controller = 'app\\controllers\\' . $params[0] . 'Controller.php';
$controller = 'app\\controllers\\' . $params[0] . 'Controller';
$action = $params[1];

$this->respond('PUT', $path, function($request, $response, $app) use ($controller, $action){
$this->respond('PUT', $path, function($request, $response, $service) use ($controller, $action){
$controller = new $controller();
$controller->loader($request, $response, $app);
$controller->loader($request, $response, $service);
return $controller->$action();
});
else:
Expand All @@ -79,12 +79,12 @@ public function delete($path = '*', $callback = NULL){
if(is_string($callback)):

$params = explode('@', $callback);
$controller = 'app\\controllers\\' . $params[0] . 'Controller.php';
$controller = 'app\\controllers\\' . $params[0] . 'Controller';
$action = $params[1];

$this->respond('DELETE', $path, function($request, $response, $app) use ($controller, $action){
$this->respond('DELETE', $path, function($request, $response, $service) use ($controller, $action){
$controller = new $controller();
$controller->loader($request, $response, $app);
$controller->loader($request, $response, $service);
return $controller->$action();
});
else:
Expand Down

0 comments on commit d7c2637

Please sign in to comment.