From 4424cee0af77956477a4d6e5f3c248a350c94296 Mon Sep 17 00:00:00 2001 From: Michael Hasselbring Date: Wed, 3 Aug 2011 08:26:40 -0500 Subject: [PATCH] moved composers, filters and routes back to application, delete routes folder --- application/composers.php | 27 +++++++++++++++ application/filters.php | 70 +++++++++++++++++++++++++++++++++++++++ application/routes.php | 47 ++++++++++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 application/composers.php create mode 100644 application/filters.php create mode 100644 application/routes.php diff --git a/application/composers.php b/application/composers.php new file mode 100644 index 00000000..cc8cc33e --- /dev/null +++ b/application/composers.php @@ -0,0 +1,27 @@ + function($view) + { + return $view; + }, + +); \ No newline at end of file diff --git a/application/filters.php b/application/filters.php new file mode 100644 index 00000000..f867d63f --- /dev/null +++ b/application/filters.php @@ -0,0 +1,70 @@ + function() + | { + | return 'Filtered!'; + | } + | + | Next, attach the filter to a route: + | + | 'GET /' => array('before' => 'simple_filter', 'do' => function() + | { + | return 'Hello World!'; + | }) + | + | Now every requests to http://example.com will return "Filtered!", since + | the filter is overriding the route action by returning a value. + | + | To make your life easier, we have built authentication and CSRF filters + | that are ready to attach to your routes. Enjoy. + | + | For more information, check out: http://laravel.com/docs/start/routes#filters + | + */ + + 'before' => function() + { + // Do stuff before every request is executed. + }, + + + 'after' => function($response) + { + // Do stuff after every request is executed. + }, + + + 'auth' => function() + { + return ( ! Auth::check()) ? Redirect::to_login() : null; + }, + + + 'csrf' => function() + { + return (Input::get('csrf_token') !== Form::raw_token()) ? Response::error('500') : null; + }, + +); \ No newline at end of file diff --git a/application/routes.php b/application/routes.php new file mode 100644 index 00000000..17a6cfa7 --- /dev/null +++ b/application/routes.php @@ -0,0 +1,47 @@ + function() + | { + | return 'Hello World!'; + | } + | + | You can even respond to more than one URI: + | + | 'GET /hello, GET /world' => function() + | { + | return 'Hello World!'; + | } + | + | Allow URI wildcards using the (:num) or (:any) place-holders: + | + | 'GET /hello/(:any)' => function($name) + | { + | return "Welcome, $name."; + | } + | + | Ready to learn more? Check out: http://laravel.com/docs/start/routes + | + */ + + 'GET /' => function() + { + return View::make('home/index'); + }, + +); \ No newline at end of file