Skip to content

Commit 226fb7e

Browse files
author
Yoel Monzon
committed
[add] configure Laravel 5
0 parents  commit 226fb7e

File tree

159 files changed

+20139
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+20139
-0
lines changed

.env.example

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
APP_ENV=local
2+
APP_DEBUG=true
3+
APP_KEY=SomeRandomString
4+
5+
DB_HOST=localhost
6+
DB_DATABASE=homestead
7+
DB_USERNAME=homestead
8+
DB_PASSWORD=secret
9+
10+
CACHE_DRIVER=file
11+
SESSION_DRIVER=file
12+
QUEUE_DRIVER=sync
13+
14+
MAIL_DRIVER=smtp
15+
MAIL_HOST=mailtrap.io
16+
MAIL_PORT=2525
17+
MAIL_USERNAME=null
18+
MAIL_PASSWORD=null

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.less linguist-vendored

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/vendor
2+
/node_modules
3+
.env

app/Commands/Command.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php namespace App\Commands;
2+
3+
abstract class Command {
4+
5+
//
6+
7+
}

app/Console/Commands/Inspire.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php namespace App\Console\Commands;
2+
3+
use Illuminate\Console\Command;
4+
use Illuminate\Foundation\Inspiring;
5+
6+
class Inspire extends Command {
7+
8+
/**
9+
* The console command name.
10+
*
11+
* @var string
12+
*/
13+
protected $name = 'inspire';
14+
15+
/**
16+
* The console command description.
17+
*
18+
* @var string
19+
*/
20+
protected $description = 'Display an inspiring quote';
21+
22+
/**
23+
* Execute the console command.
24+
*
25+
* @return mixed
26+
*/
27+
public function handle()
28+
{
29+
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
30+
}
31+
32+
}

app/Console/Kernel.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php namespace App\Console;
2+
3+
use Illuminate\Console\Scheduling\Schedule;
4+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
5+
6+
class Kernel extends ConsoleKernel {
7+
8+
/**
9+
* The Artisan commands provided by your application.
10+
*
11+
* @var array
12+
*/
13+
protected $commands = [
14+
'App\Console\Commands\Inspire',
15+
];
16+
17+
/**
18+
* Define the application's command schedule.
19+
*
20+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
21+
* @return void
22+
*/
23+
protected function schedule(Schedule $schedule)
24+
{
25+
$schedule->command('inspire')
26+
->hourly();
27+
}
28+
29+
}

app/Events/Event.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php namespace App\Events;
2+
3+
abstract class Event {
4+
5+
//
6+
7+
}

app/Exceptions/Handler.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php namespace App\Exceptions;
2+
3+
use Exception;
4+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
5+
6+
class Handler extends ExceptionHandler {
7+
8+
/**
9+
* A list of the exception types that should not be reported.
10+
*
11+
* @var array
12+
*/
13+
protected $dontReport = [
14+
'Symfony\Component\HttpKernel\Exception\HttpException'
15+
];
16+
17+
/**
18+
* Report or log an exception.
19+
*
20+
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
21+
*
22+
* @param \Exception $e
23+
* @return void
24+
*/
25+
public function report(Exception $e)
26+
{
27+
return parent::report($e);
28+
}
29+
30+
/**
31+
* Render an exception into an HTTP response.
32+
*
33+
* @param \Illuminate\Http\Request $request
34+
* @param \Exception $e
35+
* @return \Illuminate\Http\Response
36+
*/
37+
public function render($request, Exception $e)
38+
{
39+
return parent::render($request, $e);
40+
}
41+
42+
}

app/Handlers/Commands/.gitkeep

Whitespace-only changes.

app/Handlers/Events/.gitkeep

Whitespace-only changes.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php namespace App\Http\Controllers\Auth;
2+
3+
use App\Http\Controllers\Controller;
4+
use Illuminate\Contracts\Auth\Guard;
5+
use Illuminate\Contracts\Auth\Registrar;
6+
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
7+
8+
class AuthController extends Controller {
9+
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Registration & Login Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller handles the registration of new users, as well as the
16+
| authentication of existing users. By default, this controller uses
17+
| a simple trait to add these behaviors. Why don't you explore it?
18+
|
19+
*/
20+
21+
use AuthenticatesAndRegistersUsers;
22+
23+
/**
24+
* Create a new authentication controller instance.
25+
*
26+
* @param \Illuminate\Contracts\Auth\Guard $auth
27+
* @param \Illuminate\Contracts\Auth\Registrar $registrar
28+
* @return void
29+
*/
30+
public function __construct(Guard $auth, Registrar $registrar)
31+
{
32+
$this->auth = $auth;
33+
$this->registrar = $registrar;
34+
35+
$this->middleware('guest', ['except' => 'getLogout']);
36+
}
37+
38+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php namespace App\Http\Controllers\Auth;
2+
3+
use App\Http\Controllers\Controller;
4+
use Illuminate\Contracts\Auth\Guard;
5+
use Illuminate\Contracts\Auth\PasswordBroker;
6+
use Illuminate\Foundation\Auth\ResetsPasswords;
7+
8+
class PasswordController extends Controller {
9+
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Password Reset Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller is responsible for handling password reset requests
16+
| and uses a simple trait to include this behavior. You're free to
17+
| explore this trait and override any methods you wish to tweak.
18+
|
19+
*/
20+
21+
use ResetsPasswords;
22+
23+
/**
24+
* Create a new password controller instance.
25+
*
26+
* @param \Illuminate\Contracts\Auth\Guard $auth
27+
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
28+
* @return void
29+
*/
30+
public function __construct(Guard $auth, PasswordBroker $passwords)
31+
{
32+
$this->auth = $auth;
33+
$this->passwords = $passwords;
34+
35+
$this->middleware('guest');
36+
}
37+
38+
}

app/Http/Controllers/Controller.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php namespace App\Http\Controllers;
2+
3+
use Illuminate\Foundation\Bus\DispatchesCommands;
4+
use Illuminate\Routing\Controller as BaseController;
5+
use Illuminate\Foundation\Validation\ValidatesRequests;
6+
7+
abstract class Controller extends BaseController {
8+
9+
use DispatchesCommands, ValidatesRequests;
10+
11+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php namespace App\Http\Controllers;
2+
3+
class HomeController extends Controller {
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Home Controller
8+
|--------------------------------------------------------------------------
9+
|
10+
| This controller renders your application's "dashboard" for users that
11+
| are authenticated. Of course, you are free to change or remove the
12+
| controller as you wish. It is just here to get your app started!
13+
|
14+
*/
15+
16+
/**
17+
* Create a new controller instance.
18+
*
19+
* @return void
20+
*/
21+
public function __construct()
22+
{
23+
$this->middleware('auth');
24+
}
25+
26+
/**
27+
* Show the application dashboard to the user.
28+
*
29+
* @return Response
30+
*/
31+
public function index()
32+
{
33+
return view('home');
34+
}
35+
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php namespace App\Http\Controllers;
2+
3+
class WelcomeController extends Controller {
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Welcome Controller
8+
|--------------------------------------------------------------------------
9+
|
10+
| This controller renders the "marketing page" for the application and
11+
| is configured to only allow guests. Like most of the other sample
12+
| controllers, you are free to modify or remove it as you desire.
13+
|
14+
*/
15+
16+
/**
17+
* Create a new controller instance.
18+
*
19+
* @return void
20+
*/
21+
public function __construct()
22+
{
23+
$this->middleware('guest');
24+
}
25+
26+
/**
27+
* Show the application welcome screen to the user.
28+
*
29+
* @return Response
30+
*/
31+
public function index()
32+
{
33+
return view('welcome');
34+
}
35+
36+
}

app/Http/Kernel.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php namespace App\Http;
2+
3+
use Illuminate\Foundation\Http\Kernel as HttpKernel;
4+
5+
class Kernel extends HttpKernel {
6+
7+
/**
8+
* The application's global HTTP middleware stack.
9+
*
10+
* @var array
11+
*/
12+
protected $middleware = [
13+
'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
14+
'Illuminate\Cookie\Middleware\EncryptCookies',
15+
'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
16+
'Illuminate\Session\Middleware\StartSession',
17+
'Illuminate\View\Middleware\ShareErrorsFromSession',
18+
'App\Http\Middleware\VerifyCsrfToken',
19+
];
20+
21+
/**
22+
* The application's route middleware.
23+
*
24+
* @var array
25+
*/
26+
protected $routeMiddleware = [
27+
'auth' => 'App\Http\Middleware\Authenticate',
28+
'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
29+
'guest' => 'App\Http\Middleware\RedirectIfAuthenticated',
30+
];
31+
32+
}

app/Http/Middleware/Authenticate.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php namespace App\Http\Middleware;
2+
3+
use Closure;
4+
use Illuminate\Contracts\Auth\Guard;
5+
6+
class Authenticate {
7+
8+
/**
9+
* The Guard implementation.
10+
*
11+
* @var Guard
12+
*/
13+
protected $auth;
14+
15+
/**
16+
* Create a new filter instance.
17+
*
18+
* @param Guard $auth
19+
* @return void
20+
*/
21+
public function __construct(Guard $auth)
22+
{
23+
$this->auth = $auth;
24+
}
25+
26+
/**
27+
* Handle an incoming request.
28+
*
29+
* @param \Illuminate\Http\Request $request
30+
* @param \Closure $next
31+
* @return mixed
32+
*/
33+
public function handle($request, Closure $next)
34+
{
35+
if ($this->auth->guest())
36+
{
37+
if ($request->ajax())
38+
{
39+
return response('Unauthorized.', 401);
40+
}
41+
else
42+
{
43+
return redirect()->guest('auth/login');
44+
}
45+
}
46+
47+
return $next($request);
48+
}
49+
50+
}

0 commit comments

Comments
 (0)