Skip to content

Instantly share code, notes, and snippets.

@christurnertv
Created April 17, 2014 19:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save christurnertv/11005060 to your computer and use it in GitHub Desktop.
Save christurnertv/11005060 to your computer and use it in GitHub Desktop.
Laravel Environment and Error Handing Config
<?php
return array(
'debug' => true,
);
$env = $app->detectEnvironment(array(
'local' => array('your-hostname'),
));
<?php
return array(
'DB_HOST' => '',
'DB_NAME' => '',
'DB_USER' => '',
'DB_PASS' => '',
'EMAIL_USER' => '',
'EMAIL_PASS' => '',
'STRIPE_SK' => '',
'STRIPE_PK' => '',
);
<?php
...
'host' => $_ENV['DB_HOST'],
'database' => $_ENV['DB_NAME'],
'username' => $_ENV['DB_USER'],
'password' => $_ENV['DB_PASS'],
...
<?php
// ...
App::error(function(Exception $exception, $code)
{
if (Config::get('app.debug') === true)
{
Log::error($exception);
}
else
{
Log::error($exception->getMessage());
return Response::view('errors.500', array(), 500);
}
});
App::error(function(ModelNotFoundException $e)
{
return Response::view('errors.404', array(), 404);
});
App::missing(function($exception)
{
return Response::view('errors.404', array(), 404);
});
// ...
@WritingPanda
Copy link

Hey, anyone who is looking at this getting some insight: there is a fix for those who are having issues with merging branches and finding that your dev site isn't showing.

Illuminate\Database\Eloquent\ModelNotFoundException; <--- put that at the top of your app-start-global.php file. #solutions

@ryanorsinger
Copy link

hmmm, that immediately throws an exception...

[Fri Apr 18 10:23:35 2014] [error] [client 192.168.77.1] PHP Fatal error: Undefined constant 'Illuminate\Database\Eloquent\ModelNotFoundException' in /vagrant/sites/capstone.dev/app/start/global.php

is what shows in the apache scripts, hmmm

@icemancast
Copy link

use Illuminate\Database\Eloquent\ModelNotFoundException;

Don't forget the word 'use' in front of it.

@ryanorsinger
Copy link

thanks chaps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment