File: D:/HostingSpaces/SBogers87/basephotography.nl/app/controllers/BaseController.php
<?php
use Illuminate\Routing\Controller;
class BaseController extends Controller
{
public function emailAdministrator($exception, $code)
{
return false;
//Check if we exclude the email for the current url
if($this->checkExcludedErrors($code)) return false;
$mailer = \App::make('Komma\Mailers\Mailer');
$mailer->sendTo(\Config::get('business.admin_emails'), 'Fout Code ' . $code, 'emails/error',
[
'code' => $code,
'stack' => $exception->__toString(),
'path' => \Request::path()
]);
}
public function abortPage($type = 404)
{
$view = \View::make($type)->render();
return \Response::make($view, $type);
}
public function checkExcludedErrors($code){
if($code == 500)
{
if(\Request::segment(1) == 'kms' && \Request::segment(2) == 'projects') return true;
return false;
}
if($code == 404) return true;
//check if last segments starts with tel
$segments = Request::segments();
if(substr(end($segments), 0, 4)=== 'tel:') return true;
switch(\Request::segment(1)){
case 'kms':
case 'apple-touch-icon.png':
case 'wp-login.php':
case 'wp-admin':
case 'blog/wp-login.php':
case 'wp':
case 'wordpress':
case 'administrator':
case 'www.googletagmanager.com/ns.html':
case 'autodiscover':
case 'browserconfig.xml':
return true;
default:
return false;
}
}
}