Skip to content

Instantly share code, notes, and snippets.

@0test
Created March 15, 2022 17:37
Show Gist options
  • Save 0test/c942698004522948a427efc59e1f133e to your computer and use it in GitHub Desktop.
Save 0test/c942698004522948a427efc59e1f133e to your computer and use it in GitHub Desktop.
<?php
namespace EvolutionCMS\Main\Controllers;
use Illuminate\Support\Facades\Cache;
class BaseController{
public $data = [];
public function __construct()
{
$this->evo = EvolutionCMS();
ksort($_GET);
$cacheid = md5(json_encode($_GET));
if ($this->evo->getConfig('enable_cache')) {
$this->data = Cache::rememberForever($cacheid, function () {
$this->render();
$this->globalElements();
return $this->data;
});
} else {
$this->globalElements();
$this->render();
}
$this->noCacheRender();
$this->sendToView();
}
public function render()
{
}
public function globalElements()
{
$this->data['pages'] = 'pages';
}
public function noCacheRender()
{
}
public function sendToView()
{
$this->evo->addDataToView($this->data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment