Skip to content
Snippets Groups Projects
PageController.php 1.18 KiB
Newer Older
  • Learn to ignore specific revisions
  • <?php
    
    /**
     * @copyright  2020 Podlibre
     * @license    https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
     * @link       https://castopod.org/
     */
    
    namespace App\Controllers;
    
    
    use CodeIgniter\Exceptions\PageNotFoundException;
    
    class PageController extends BaseController
    
        public function _remap(string $method, string ...$params): mixed
    
                throw PageNotFoundException::forPageNotFound();
    
            }
    
            if (
                $this->page = (new PageModel())->where('slug', $params[0])->first()
            ) {
    
        public function index(): string
    
            if (! ($found = cache($cacheName))) {
    
                $data = [
                    'page' => $this->page,
                ];
    
                $found = view('page', $data);
    
                // The page cache is set to a decade so it is deleted manually upon page update
    
                cache()
                    ->save($cacheName, $found, DECADE);