Skip to content

Instantly share code, notes, and snippets.

@szainmehdi
Created February 7, 2015 07:28
Show Gist options
  • Save szainmehdi/fdf3cbf9822cb7c5c201 to your computer and use it in GitHub Desktop.
Save szainmehdi/fdf3cbf9822cb7c5c201 to your computer and use it in GitHub Desktop.
<?php
use App\Cache\Cache;
class WhateverController {
/** @var \App\Cache\Cache $cache */
private $cache;
public function __construct(Cache $cache) {
$this->cache = $cache;
}
public function index() {
if($this->isInMaintenanceMode()) {
return Response::view('mainteance', [], 503);
}
}
private function isInMaintenanceMode() {
return $this->cache->getSetting()->mainteance_mode === 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment