diff --git a/Commands/MakeFilter.php b/Commands/MakeFilter.php new file mode 100644 index 0000000..7977380 --- /dev/null +++ b/Commands/MakeFilter.php @@ -0,0 +1,71 @@ + 'App\Filters', + 'name' => $name, + 'today' => date('Y-m-d H:i:a'), + ]; + + $destination = $this->determineOutputPath('Filters').$name.'.php'; + + $overwrite = (bool)CLI::getOption('f'); + + try { + $this->copyTemplate($view, $destination, $data, $overwrite); + } + catch (\Exception $e) + { + $this->showError($e); + } + } + +} diff --git a/Views/Filter/Filter.php b/Views/Filter/Filter.php new file mode 100644 index 0000000..ea64f7c --- /dev/null +++ b/Views/Filter/Filter.php @@ -0,0 +1,43 @@ +@php namespace {namespace}; + +use CodeIgniter\Filters\FilterInterface; +use CodeIgniter\HTTP\RequestInterface; +use CodeIgniter\HTTP\ResponseInterface; +use Config\Services; + +/** + * {! name !} Filter + * + * Generated by Vulcan at {! today !} + */ +class {! name !} implements FilterInterface +{ + + /** + * + * + * @param RequestInterface|\CodeIgniter\HTTP\IncomingRequest $request + * + * @return mixed + */ + public function before(RequestInterface $request) + { + // + } + + //-------------------------------------------------------------------- + + /** + * + * + * @param RequestInterface|\CodeIgniter\HTTP\IncomingRequest $request + * @param ResponseInterface|\CodeIgniter\HTTP\Response $response + * + * @return mixed + */ + public function after(RequestInterface $request, ResponseInterface $response) + { + // + } + +}