Created
April 17, 2014 19:02
-
-
Save christurnertv/11005060 to your computer and use it in GitHub Desktop.
Laravel Environment and Error Handing Config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return array( | |
'debug' => true, | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$env = $app->detectEnvironment(array( | |
'local' => array('your-hostname'), | |
)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return array( | |
'DB_HOST' => '', | |
'DB_NAME' => '', | |
'DB_USER' => '', | |
'DB_PASS' => '', | |
'EMAIL_USER' => '', | |
'EMAIL_PASS' => '', | |
'STRIPE_SK' => '', | |
'STRIPE_PK' => '', | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
'host' => $_ENV['DB_HOST'], | |
'database' => $_ENV['DB_NAME'], | |
'username' => $_ENV['DB_USER'], | |
'password' => $_ENV['DB_PASS'], | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
}); | |
// ... |
use Illuminate\Database\Eloquent\ModelNotFoundException;
Don't forget the word 'use' in front of it.
thanks chaps!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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