Skip to content

Commit

Permalink
add new type request
Browse files Browse the repository at this point in the history
  • Loading branch information
foxtech6 committed May 18, 2019
1 parent 432e695 commit 8ea75e5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Kernel/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ abstract class AbstractController
*/
private $view;

/**
* Show if request is ajax
*
* @var bool
*/
private $isAjax;

/**
* View render
*
Expand All @@ -58,6 +65,14 @@ public function render(string $view, array $params = []): self
return $this;
}

/**
* Set request is ajax
*/
public function isAjax(): void
{
$this->isAjax = true;
}

/**
* Get error to view
*
Expand All @@ -76,6 +91,10 @@ public function withErrors(AbstractRequest $request): void
*/
public function __destruct()
{
if ($this->isAjax) {
return;
}

if ($this->params) {
extract($this->params);
}
Expand Down

0 comments on commit 8ea75e5

Please sign in to comment.