Skip to content

Commit 30c50ff

Browse files
committed
Install framework
0 parents  commit 30c50ff

Some content is hidden

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

76 files changed

+5607
-0
lines changed

.env.example

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
APP_ENV=local
2+
APP_DEBUG=true
3+
APP_KEY=SomeRandomString
4+
APP_URL=http://localhost
5+
6+
DB_CONNECTION=mysql
7+
DB_HOST=127.0.0.1
8+
DB_PORT=3306
9+
DB_DATABASE=homestead
10+
DB_USERNAME=homestead
11+
DB_PASSWORD=secret
12+
13+
CACHE_DRIVER=file
14+
SESSION_DRIVER=file
15+
QUEUE_DRIVER=sync
16+
17+
REDIS_HOST=127.0.0.1
18+
REDIS_PASSWORD=null
19+
REDIS_PORT=6379
20+
21+
MAIL_DRIVER=smtp
22+
MAIL_HOST=mailtrap.io
23+
MAIL_PORT=2525
24+
MAIL_USERNAME=null
25+
MAIL_PASSWORD=null
26+
MAIL_ENCRYPTION=null

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.scss linguist-vendored

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/vendor
2+
/node_modules
3+
/public/storage
4+
Homestead.yaml
5+
Homestead.json
6+
.env

app/Console/Commands/Inspire.php

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

app/Console/Kernel.php

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

app/Events/Event.php

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

app/Exceptions/Handler.php

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Exception;
6+
use Illuminate\Validation\ValidationException;
7+
use Illuminate\Auth\Access\AuthorizationException;
8+
use Illuminate\Database\Eloquent\ModelNotFoundException;
9+
use Symfony\Component\HttpKernel\Exception\HttpException;
10+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
11+
12+
class Handler extends ExceptionHandler
13+
{
14+
/**
15+
* A list of the exception types that should not be reported.
16+
*
17+
* @var array
18+
*/
19+
protected $dontReport = [
20+
AuthorizationException::class,
21+
HttpException::class,
22+
ModelNotFoundException::class,
23+
ValidationException::class,
24+
];
25+
26+
/**
27+
* Report or log an exception.
28+
*
29+
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
30+
*
31+
* @param \Exception $e
32+
* @return void
33+
*/
34+
public function report(Exception $e)
35+
{
36+
parent::report($e);
37+
}
38+
39+
/**
40+
* Render an exception into an HTTP response.
41+
*
42+
* @param \Illuminate\Http\Request $request
43+
* @param \Exception $e
44+
* @return \Illuminate\Http\Response
45+
*/
46+
public function render($request, Exception $e)
47+
{
48+
return parent::render($request, $e);
49+
}
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\User;
6+
use Validator;
7+
use App\Http\Controllers\Controller;
8+
use Illuminate\Foundation\Auth\ThrottlesLogins;
9+
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
10+
11+
class AuthController extends Controller
12+
{
13+
/*
14+
|--------------------------------------------------------------------------
15+
| Registration & Login Controller
16+
|--------------------------------------------------------------------------
17+
|
18+
| This controller handles the registration of new users, as well as the
19+
| authentication of existing users. By default, this controller uses
20+
| a simple trait to add these behaviors. Why don't you explore it?
21+
|
22+
*/
23+
24+
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
25+
26+
/**
27+
* Where to redirect users after login / registration.
28+
*
29+
* @var string
30+
*/
31+
protected $redirectTo = '/';
32+
33+
/**
34+
* Create a new authentication controller instance.
35+
*
36+
* @return void
37+
*/
38+
public function __construct()
39+
{
40+
$this->middleware($this->guestMiddleware(), ['except' => 'logout']);
41+
}
42+
43+
/**
44+
* Get a validator for an incoming registration request.
45+
*
46+
* @param array $data
47+
* @return \Illuminate\Contracts\Validation\Validator
48+
*/
49+
protected function validator(array $data)
50+
{
51+
return Validator::make($data, [
52+
'name' => 'required|max:255',
53+
'email' => 'required|email|max:255|unique:users',
54+
'password' => 'required|min:6|confirmed',
55+
]);
56+
}
57+
58+
/**
59+
* Create a new user instance after a valid registration.
60+
*
61+
* @param array $data
62+
* @return User
63+
*/
64+
protected function create(array $data)
65+
{
66+
return User::create([
67+
'name' => $data['name'],
68+
'email' => $data['email'],
69+
'password' => bcrypt($data['password']),
70+
]);
71+
}
72+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
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+
* @return void
27+
*/
28+
public function __construct()
29+
{
30+
$this->middleware($this->guestMiddleware());
31+
}
32+
}

app/Http/Controllers/Controller.php

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Foundation\Bus\DispatchesJobs;
6+
use Illuminate\Routing\Controller as BaseController;
7+
use Illuminate\Foundation\Validation\ValidatesRequests;
8+
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
9+
use Illuminate\Foundation\Auth\Access\AuthorizesResources;
10+
11+
class Controller extends BaseController
12+
{
13+
use AuthorizesRequests, AuthorizesResources, DispatchesJobs, ValidatesRequests;
14+
}

app/Http/Kernel.php

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
namespace App\Http;
4+
5+
use Illuminate\Foundation\Http\Kernel as HttpKernel;
6+
7+
class Kernel extends HttpKernel
8+
{
9+
/**
10+
* The application's global HTTP middleware stack.
11+
*
12+
* These middleware are run during every request to your application.
13+
*
14+
* @var array
15+
*/
16+
protected $middleware = [
17+
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
18+
];
19+
20+
/**
21+
* The application's route middleware groups.
22+
*
23+
* @var array
24+
*/
25+
protected $middlewareGroups = [
26+
'web' => [
27+
\App\Http\Middleware\EncryptCookies::class,
28+
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
29+
\Illuminate\Session\Middleware\StartSession::class,
30+
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
31+
\App\Http\Middleware\VerifyCsrfToken::class,
32+
],
33+
34+
'api' => [
35+
'throttle:60,1',
36+
],
37+
];
38+
39+
/**
40+
* The application's route middleware.
41+
*
42+
* These middleware may be assigned to groups or used individually.
43+
*
44+
* @var array
45+
*/
46+
protected $routeMiddleware = [
47+
'auth' => \App\Http\Middleware\Authenticate::class,
48+
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
49+
'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class,
50+
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
51+
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
52+
];
53+
}

app/Http/Middleware/Authenticate.php

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace App\Http\Middleware;
4+
5+
use Closure;
6+
use Illuminate\Support\Facades\Auth;
7+
8+
class Authenticate
9+
{
10+
/**
11+
* Handle an incoming request.
12+
*
13+
* @param \Illuminate\Http\Request $request
14+
* @param \Closure $next
15+
* @param string|null $guard
16+
* @return mixed
17+
*/
18+
public function handle($request, Closure $next, $guard = null)
19+
{
20+
if (Auth::guard($guard)->guest()) {
21+
if ($request->ajax() || $request->wantsJson()) {
22+
return response('Unauthorized.', 401);
23+
} else {
24+
return redirect()->guest('login');
25+
}
26+
}
27+
28+
return $next($request);
29+
}
30+
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace App\Http\Middleware;
4+
5+
use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter;
6+
7+
class EncryptCookies extends BaseEncrypter
8+
{
9+
/**
10+
* The names of the cookies that should not be encrypted.
11+
*
12+
* @var array
13+
*/
14+
protected $except = [
15+
//
16+
];
17+
}

0 commit comments

Comments
 (0)