refactoring.

This commit is contained in:
Taylor Otwell
2011-09-21 21:46:16 -05:00
parent b9b9711921
commit 0c4018ec88
42 changed files with 980 additions and 1330 deletions

View File

@@ -25,7 +25,7 @@ return array(
'Cache' => 'Laravel\\Cache',
'Config' => 'Laravel\\Config',
'Controller' => 'Laravel\\Controller',
'Cookie' => 'Laravel\\Cookie',
'Cookie' => 'Laravel\\Facades\\Cookie',
'Crypter' => 'Laravel\\Facades\\Crypter',
'DB' => 'Laravel\\Database\\Manager',
'Eloquent' => 'Laravel\\Database\\Eloquent\\Model',
@@ -34,20 +34,20 @@ return array(
'Hasher' => 'Laravel\\Facades\\Hasher',
'HTML' => 'Laravel\\HTML',
'Inflector' => 'Laravel\\Inflector',
'Input' => 'Laravel\\Input',
'Input' => 'Laravel\\Facades\\Input',
'IoC' => 'Laravel\\IoC',
'Lang' => 'Laravel\\Lang',
'Loader' => 'Laravel\\Loader',
'Messages' => 'Laravel\\Validation\\Messages',
'Package' => 'Laravel\\Facades\\Package',
'URI' => 'Laravel\\URI',
'URI' => 'Laravel\\Facades\\URI',
'URL' => 'Laravel\\URL',
'Redirect' => 'Laravel\\Redirect',
'Request' => 'Laravel\\Request',
'Request' => 'Laravel\\Facades\\Request',
'Response' => 'Laravel\\Response',
'Session' => 'Laravel\\Facades\\Session',
'Str' => 'Laravel\\Str',
'Validator' => 'Laravel\\Validator',
'Validator' => 'Laravel\\Validation\\Validator',
'View' => 'Laravel\\View',
);

View File

@@ -2,12 +2,83 @@
return array(
/*
|--------------------------------------------------------------------------
| Error Detail
|--------------------------------------------------------------------------
|
| Detailed error messages contain information about the file in which
| an error occurs, a stack trace, and a snapshot of the source code
| in which the error occured.
|
| If your application is in production, consider turning off error details
| for enhanced security and user experience.
|
*/
'detail' => true,
/*
|--------------------------------------------------------------------------
| Error Logging
|--------------------------------------------------------------------------
|
| Error Logging will use the "logger" function defined below to log error
| messages, which gives you complete freedom to determine how error
| messages are logged. Enjoy the flexibility.
|
*/
'log' => false,
/*
|--------------------------------------------------------------------------
| Error Handler
|--------------------------------------------------------------------------
|
| Because of the various ways of managing error logging, you get complete
| flexibility in Laravel to manage error logging as you see fit.
|
| This function will be called when an error occurs in your application.
| You can log the error however you like.
|
| The error "severity" passed to the method is a human-readable severity
| level such as "Parsing Error" or "Fatal Error".
|
| A simple logging system has been setup for you. By default, all errors
| will be logged to the storage/log.txt file.
|
*/
'handler' => function($exception, $severity, $message, $config)
{
if ($config['detail'])
{
$data = compact('exception', 'severity', 'message');
$response = Response::view('error.exception', $data)->status(500);
}
else
{
$response = Response::error('500');
}
if ($config['log'])
{
call_user_func($config['logger'], $severity, $message);
}
$response->send();
exit(1);
},
/*
|--------------------------------------------------------------------------
| Error Logger
|--------------------------------------------------------------------------
|
| Because of the various ways of managing error logging, you get complete
| flexibility to manage error logging as you see fit.
|
| This function will be called when an error occurs in your application.
@@ -21,11 +92,9 @@ return array(
|
*/
'handler' => function($exception)
'logger' => function($severity, $message)
{
var_dump($exception);
exit(1);
},
File::append(STORAGE_PATH.'log.txt', date('Y-m-d H:i:s').' '.$severity.' - '.$message.PHP_EOL);
}
);

View File

@@ -56,7 +56,7 @@ return array(
'auth' => function()
{
return ( ! Auth::make()->check()) ? Redirect::to_login() : null;
return ( ! Auth::check()) ? Redirect::to('login') : null;
},

View File

@@ -1,87 +1,64 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>404 - Not Found</title>
<head>
<meta charset="utf-8">
<link href="http://fonts.googleapis.com/css?family=Quattrocento&amp;v1" rel="stylesheet" type="text/css" media="all" />
<link href="http://fonts.googleapis.com/css?family=Ubuntu&amp;v1" rel="stylesheet" type="text/css" media="all" />
<link href='http://fonts.googleapis.com/css?family=Lobster+Two' rel='stylesheet' type='text/css'>
<title>Error 404 - Not Found</title>
<style type="text/css">
body {
background-color: #eee;
color: #6d6d6d;
font-family: 'Ubuntu';
font-size: 16px;
}
<style>
@import url(http://fonts.googleapis.com/css?family=Ubuntu);
a {
color: #7089b3;
font-weight: bold;
text-decoration: none;
}
body {
background:#eee;
color: #6d6d6d;
font: normal normal normal 16px/1.253 Ubuntu, sans-serif;
margin:0;
min-width:800px;
padding:0;
}
h1.laravel {
font-family: 'Lobster Two', Helvetica, serif;
font-size: 60px;
margin: 0 0 15px -10px;
padding: 0;
text-shadow: -1px 1px 1px #fff;
}
#main {
background-clip: padding-box;
background-color: #fff;
border:1px solid #ccc;
border-radius: 5px;
box-shadow: 0 0 10px #cdcdcd;
margin: 50px auto 0;
padding: 30px;
width: 700px;
}
h2 {
font-family: 'Quattrocento', serif;
font-size: 30px;
margin: 30px 0 0 0;
padding: 0;
text-shadow: -1px 1px 1px #fff;
}
#main h1 {
font-family: 'Ubuntu';
font-size: 34px;
margin: 0 0 20px 0;
padding: 0;
}
p {
margin: 10px 0 0 0;
line-height: 25px;
}
#main h2,h3 {
margin-top: 25px;
padding: 0 0 0 0;
}
#header {
margin: 0 auto;
margin-bottom: 15px;
margin-top: 20px;
width: 80%;
}
#main h3 {
font-size: 18px;
}
#wrapper {
background-color: #fff;
border-radius: 10px;
margin: 0 auto;
padding: 10px;
width: 80%;
}
#main p {
line-height: 25px;
margin: 10px 0;
}
</style>
</head>
<body>
<div id="main">
<?php $messages = array('We need a map.', 'I think we\'re lost.', 'We took a wrong turn.'); ?>
#wrapper h2:first-of-type {
margin-top: 0;
}
</style>
</head>
<body>
<div id="header">
<?php
$messages = array("We're lost.", "This doesn't look familiar.", "We need a map.");
$message = $messages[mt_rand(0, 2)];
?>
<h1><?php echo $messages[mt_rand(0, 2)]; ?></h1>
<h1 class="laravel"><?php echo $message; ?></h1>
</div>
<p>We're really sorry, but we couldn't find the resource you requested.</p>
<div id="wrapper">
<?php
$apologies = array("This is embarrassing.", "Don't give up on us.", "We're really sorry.");
$apology = $apologies[mt_rand(0, 2)];
?>
<h2><?php echo $apology; ?></h2>
<p>We couldn't find the resource you requested. Would you like go to our <a href="<?php echo Config::get('application.url'); ?>">home page</a> instead?</p>
</div>
</body>
<p>Perhaps you would like to go to our <?php echo HTML::link('/', 'home page'); ?> instead?</p>
</div>
</body>
</html>

View File

@@ -1,87 +1,55 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>500 - Internal Server Error</title>
<head>
<meta charset="utf-8">
<link href="http://fonts.googleapis.com/css?family=Quattrocento&amp;v1" rel="stylesheet" type="text/css" media="all" />
<link href="http://fonts.googleapis.com/css?family=Ubuntu&amp;v1" rel="stylesheet" type="text/css" media="all" />
<link href='http://fonts.googleapis.com/css?family=Lobster+Two' rel='stylesheet' type='text/css'>
<title>Error 500 - Internal Server Error</title>
<style type="text/css">
body {
background-color: #eee;
color: #6d6d6d;
font-family: 'Ubuntu';
font-size: 16px;
}
<style>
@import url(http://fonts.googleapis.com/css?family=Ubuntu);
a {
color: #7089b3;
font-weight: bold;
text-decoration: none;
}
body {
background:#eee;
color: #6d6d6d;
font: normal normal normal 14px/1.253 Ubuntu, sans-serif;
margin:0;
min-width:800px;
padding:0;
}
h1.laravel {
font-family: 'Lobster Two', Helvetica, serif;
font-size: 60px;
margin: 0 0 15px -10px;
padding: 0;
text-shadow: -1px 1px 1px #fff;
}
#main {
background-clip: padding-box;
background-color: #fff;
border:1px solid #ccc;
border-radius: 5px;
box-shadow: 0 0 10px #cdcdcd;
margin: 50px auto 0;
padding: 30px;
width: 700px;
}
h2 {
font-family: 'Quattrocento', serif;
font-size: 30px;
margin: 30px 0 0 0;
padding: 0;
text-shadow: -1px 1px 1px #fff;
}
#main h1 {
font-family: 'Ubuntu';
font-size: 34px;
margin: 0 0 20px 0;
padding: 0;
}
p {
margin: 10px 0 0 0;
line-height: 25px;
}
#main p {
line-height: 25px;
margin: 10px 0;
}
</style>
</head>
<body>
<div id="main">
<?php $messages = array('Something bad has happened.', 'We messed up.', 'Whoops!'); ?>
#header {
margin: 0 auto;
margin-bottom: 15px;
margin-top: 20px;
width: 80%;
}
<h1><?php echo $messages[mt_rand(0, 2)]; ?></h1>
#wrapper {
background-color: #fff;
border-radius: 10px;
margin: 0 auto;
padding: 10px;
width: 80%;
}
<p>We're really sorry, but something went wrong while we were processing your request.</p>
#wrapper h2:first-of-type {
margin-top: 0;
}
</style>
</head>
<body>
<div id="header">
<?php
$messages = array('Whoops!', 'Oh no!', 'Ouch!');
$message = $messages[mt_rand(0, 2)];
?>
<h1 class="laravel"><?php echo $message; ?></h1>
</div>
<div id="wrapper">
<?php
$apologies = array("It's not your fault.", "Don't give up on us.", "We're really sorry.");
$apology = $apologies[mt_rand(0, 2)];
?>
<h2><?php echo $apology; ?></h2>
<p>Something failed while we were handling your request. Would you like go to our <a href="<?php echo Config::get('application.url'); ?>">home page</a> instead?</p>
</div>
</body>
<p>Perhaps you would like to go to our <?php echo HTML::link('/', 'home page'); ?> instead?</p>
</div>
</body>
</html>

View File

@@ -1,102 +1,89 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Laravel - <?php echo $severity; ?></title>
<link href="http://fonts.googleapis.com/css?family=Quattrocento&amp;v1" rel="stylesheet" type="text/css" media="all" />
<link href="http://fonts.googleapis.com/css?family=Ubuntu&amp;v1" rel="stylesheet" type="text/css" media="all" />
<link href='http://fonts.googleapis.com/css?family=Lobster+Two' rel='stylesheet' type='text/css'>
<head>
<meta charset="utf-8">
<style type="text/css">
body {
background-color: #eee;
color: #6d6d6d;
font-family: 'Ubuntu';
font-size: 15px;
}
<title>Laravel - Uncaught Exception</title>
h1.laravel {
font-family: 'Lobster Two', Helvetica, serif;
font-size: 60px;
margin: 0 0 15px -10px;
padding: 0;
text-shadow: -1px 1px 1px #fff;
}
<style>
@import url(http://fonts.googleapis.com/css?family=Ubuntu);
h2 {
font-family: 'Quattrocento', serif;
font-size: 30px;
margin: 30px 0 0 0;
padding: 0;
text-shadow: -1px 1px 1px #fff;
}
body {
background:#eee;
color: #6d6d6d;
font: normal normal normal 14px/1.253 Ubuntu, sans-serif;
margin:0;
min-width:1000px;
padding:0;
}
p {
margin: 10px 0 0 0;
line-height: 25px;
}
#main {
background-clip: padding-box;
background-color: #fff;
border:1px solid #ccc;
border-radius: 5px;
box-shadow: 0 0 10px #cdcdcd;
margin: 50px auto 0;
padding: 30px;
width: 900px;
}
pre {
font-size: 12px;
}
#main h1 {
font-family: 'Ubuntu';
font-size: 34px;
margin: 0 0 20px 0;
padding: 0;
}
pre.context {
margin: 0; padding: 0;
}
#main h2,h3 {
margin-top: 25px;
padding: 0 0 0 0;
}
pre.highlight {
font-weight: bold;
color: #990000;
}
#main h3 {
font-size: 18px;
}
#header {
margin: 0 auto;
margin-bottom: 15px;
margin-top: 20px;
width: 80%;
}
#main p {
line-height: 25px;
margin: 10px 0;
}
#wrapper {
background-color: #fff;
border-radius: 10px;
margin: 0 auto;
padding: 10px;
width: 80%;
}
#main pre {
font-size: 12px;
background-color: #f0f0f0;
border-left: 1px solid #d8d8d8;
border-top: 1px solid #d8d8d8;
border-radius: 5px;
padding: 10px;
white-space: pre-wrap;
}
</style>
</head>
<body>
<div id="main">
<h1><?php echo $severity; ?></h1>
#wrapper h2:first-of-type {
margin-top: 0;
}
</style>
</head>
<body>
<div id="header">
<h1 class="laravel"><?php echo $severity; ?></h1>
</div>
<h3>Message</h3>
<div id="wrapper">
<h2>Message:</h2>
<pre><?php echo $message; ?></pre>
<p><?php echo $message; ?></p>
<h3>Stack Trace</h3>
<h2>Stack Trace:</h2>
<pre><?php echo $exception->getTraceAsString(); ?></pre>
<pre><?php echo $trace; ?></pre>
<h3>Snapshot</h3>
<h2>Snapshot:</h2>
<?php
$lines = array();
<p>
<?php if (count($contexts) > 0): ?>
foreach (File::snapshot($exception->getFile(), $exception->getLine()) as $num => $context)
{
$lines[] = $num.': '.$context;
}
?>
<?php foreach($contexts as $num => $context): ?>
<pre class="context <?php echo ($line == $num) ? 'highlight' : ''; ?>"><?php echo htmlentities($num.': '.$context); ?></pre>
<?php endforeach; ?>
<?php else: ?>
Snapshot Unavailable.
<?php endif; ?>
</p>
</div>
</body>
<pre><?php echo htmlentities(implode("\n", $lines)); ?></pre>
</div>
</body>
</html>

View File

@@ -1,79 +1,108 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Welcome To Laravel!</title>
<link href="http://fonts.googleapis.com/css?family=Quattrocento&amp;v1" rel="stylesheet" type="text/css" media="all" />
<link href="http://fonts.googleapis.com/css?family=Ubuntu&amp;v1" rel="stylesheet" type="text/css" media="all" />
<link href='http://fonts.googleapis.com/css?family=Lobster+Two' rel='stylesheet' type='text/css'>
<head>
<meta charset="utf-8">
<style type="text/css">
body {
background-color: #eee;
color: #6d6d6d;
font-family: 'Ubuntu';
font-size: 15px;
}
<title>Laravel - A Framework For Web Artisans</title>
a {
color: #7089b3;
font-weight: bold;
text-decoration: none;
}
<style>
@import url(http://fonts.googleapis.com/css?family=Ubuntu);
h1.laravel {
font-family: 'Lobster Two', Helvetica, serif;
font-size: 60px;
margin: 0 0 15px -10px;
padding: 0;
text-shadow: -1px 1px 1px #fff;
}
body {
background:#eee;
color: #6d6d6d;
font: normal normal normal 14px/1.253 Ubuntu, sans-serif;
margin:0;
min-width:800px;
padding:0;
}
h2 {
font-family: 'Quattrocento', serif;
font-size: 30px;
margin: 30px 0 0 0;
padding: 0;
text-shadow: -1px 1px 1px #fff;
}
#main {
background-clip: padding-box;
background-color: #fff;
border:1px solid #ccc;
border-radius: 5px;
box-shadow: 0 0 10px #cdcdcd;
margin: 50px auto 0;
padding: 30px;
width: 700px;
}
p {
margin: 10px 0 0 0;
line-height: 25px;
}
#main h1 {
font-family: 'Ubuntu';
font-size: 34px;
margin: 0 0 20px 0;
padding: 0;
}
#header {
margin: 0 auto;
margin-bottom: 15px;
margin-top: 20px;
width: 80%;
}
#main h2,h3 {
margin-top: 25px;
padding: 0 0 0 0;
}
.wrapper {
background-color: #fff;
border-radius: 10px;
margin: 0 auto;
padding: 10px;
width: 80%;
}
#main h3 {
font-size: 18px;
}
.wrapper h2:first-of-type {
margin-top: 0;
}
</style>
</head>
<body>
<div id="header">
<h1 class="laravel">Laravel</h1>
</div>
#main p {
line-height: 25px;
margin: 10px 0;
}
<div class="wrapper">
<h2>Installation Complete!</h2>
#main pre {
background-color: #f0f0f0;
border-left: 1px solid #d8d8d8;
border-top: 1px solid #d8d8d8;
border-radius: 5px;
padding: 10px;
}
<p>Ready to dig in? Start building your application in the <strong>application/routes.php</strong> file.</p>
#main ul {
margin: 10px 0;
padding: 0 30px;
}
<p>Need to learn more? Peruse our <a href="http://laravel.com">wonderful documentation</a>.</p>
</div>
</body>
#main li {
margin: 5px 0;
}
</style>
</head>
<body>
<div id="main">
<h1>Welcome to Laravel</h1>
<p>
You have successfully installed the Laravel framework. Laravel is a simple framework
to help web artisans create beautiful, creative applications using elegant, expressive
syntax. You'll love using it.
</p>
<h3>Learn the terrain.</h3>
<p>
You've landed yourself on our default home page. The route that
is generating this page lives at:
</p>
<pre><code>APP_PATH/routes.php</code></pre>
<p>And the view sitting before you can be found at:</p>
<pre><code>APP_PATH/views/home/index.php</code></pre>
<h3>Create something beautiful.</h3>
<p>
Now that you're up and running, it's time to start creating!
Here are some links to help you get started:
</p>
<ul>
<li><a href="http://laravel.com">Official Website</a></li>
<li><a href="http://forums.laravel.com">Laravel Forums</a></li>
<li><a href="http://github.com/laravel/laravel">GitHub Repository</a></li>
</ul>
</div>
</body>
</html>