Working on app structure.
This commit is contained in:
23
app/http/controllers/HomeController.php
Normal file
23
app/http/controllers/HomeController.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
class HomeController extends Controller {
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Home Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish to use controllers instead of, or in addition to, Closure
|
||||
| based routes. That's great! Here is an example controller method to
|
||||
| get you started. To route to this controller, just add the route:
|
||||
|
|
||||
| Route::get('/', 'HomeController@index');
|
||||
|
|
||||
*/
|
||||
|
||||
public function index()
|
||||
{
|
||||
return View::make('hello');
|
||||
}
|
||||
|
||||
}
|
||||
28
app/http/filters/AuthFilter.php
Normal file
28
app/http/filters/AuthFilter.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AuthFilter {
|
||||
|
||||
/**
|
||||
* Run the request filter.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function filter(Request $request)
|
||||
{
|
||||
if (Auth::guest())
|
||||
{
|
||||
if ($request->ajax())
|
||||
{
|
||||
return Response::make('Unauthorized', 401);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Redirect::guest('login');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
15
app/http/filters/BasicAuthFilter.php
Normal file
15
app/http/filters/BasicAuthFilter.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
class BasicAuthFilter {
|
||||
|
||||
/**
|
||||
* Run the request filter.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function filter()
|
||||
{
|
||||
return Auth::basic();
|
||||
}
|
||||
|
||||
}
|
||||
21
app/http/filters/CsrfFilter.php
Normal file
21
app/http/filters/CsrfFilter.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Route;
|
||||
|
||||
class CsrfFilter {
|
||||
|
||||
/**
|
||||
* Run the request filter.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function filter(Route $route, Request $request)
|
||||
{
|
||||
if (Session::token() != $request->input('_token'))
|
||||
{
|
||||
throw new Illuminate\Session\TokenMismatchException;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
18
app/http/filters/GuestFilter.php
Normal file
18
app/http/filters/GuestFilter.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
class GuestFilter {
|
||||
|
||||
/**
|
||||
* Run the request filter.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function filter()
|
||||
{
|
||||
if (Auth::check())
|
||||
{
|
||||
return Redirect::to('/');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
18
app/http/filters/MaintenanceFilter.php
Normal file
18
app/http/filters/MaintenanceFilter.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
class MaintenanceFilter {
|
||||
|
||||
/**
|
||||
* Run the request filter.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function filter()
|
||||
{
|
||||
if (App::isDownForMaintenance())
|
||||
{
|
||||
return Response::make('Be right back!');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
0
app/http/requests/.gitkeep
Normal file
0
app/http/requests/.gitkeep
Normal file
Reference in New Issue
Block a user