Skip to content

Commit 7d6acad

Browse files
Merge pull request #41 from specialtactics/v2
Laravel 7 updates
2 parents 9fc57fd + 17ce817 commit 7d6acad

27 files changed

+181
-120
lines changed

app/Exceptions/Handler.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class Handler extends ExceptionHandler
3636
*
3737
* @param Throwable $exception
3838
* @return void
39+
*
40+
* @throws \Exception
3941
*/
4042
public function report(Throwable $exception)
4143
{

app/Http/Kernel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Kernel extends HttpKernel
1515
*/
1616
protected $middleware = [
1717
\App\Http\Middleware\TrustProxies::class,
18+
\Fruitcake\Cors\HandleCors::class,
1819
\App\Http\Middleware\CheckForMaintenanceMode::class,
1920
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
2021
\App\Http\Middleware\TrimStrings::class,
@@ -40,7 +41,7 @@ class Kernel extends HttpKernel
4041
'api' => [
4142
'snake_case',
4243
'throttle:60,1',
43-
'bindings',
44+
\Illuminate\Routing\Middleware\SubstituteBindings::class,
4445
],
4546
];
4647

app/Http/Middleware/RedirectIfAuthenticated.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Http\Middleware;
44

5+
use App\Providers\RouteServiceProvider;
56
use Closure;
67
use Illuminate\Support\Facades\Auth;
78

@@ -18,7 +19,7 @@ class RedirectIfAuthenticated
1819
public function handle($request, Closure $next, $guard = null)
1920
{
2021
if (Auth::guard($guard)->check()) {
21-
return redirect('/home');
22+
return redirect(RouteServiceProvider::HOME);
2223
}
2324

2425
return $next($request);

app/Http/Middleware/VerifyCsrfToken.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@
66

77
class VerifyCsrfToken extends Middleware
88
{
9-
/**
10-
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
11-
*
12-
* @var bool
13-
*/
14-
protected $addHttpCookie = true;
15-
169
/**
1710
* The URIs that should be excluded from CSRF verification.
1811
*

app/Models/User.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ class User extends BaseModel implements
4949
'password', 'remember_token', 'email_verified_at', 'primary_role',
5050
];
5151

52+
/**
53+
* The attributes that should be cast to native types.
54+
*
55+
* @var array
56+
*/
57+
protected $casts = [
58+
'email_verified_at' => 'datetime',
59+
];
60+
5261
/**
5362
* Model's boot function
5463
*/

app/Providers/AppServiceProvider.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@
99
class AppServiceProvider extends ServiceProvider
1010
{
1111
/**
12-
* Bootstrap any application services.
12+
* Register any application services.
1313
*
1414
* @return void
1515
*/
16-
public function boot()
16+
public function register()
1717
{
18-
//
18+
$this->registerExceptionHandler();
19+
$this->registerTelescope();
1920
}
2021

2122
/**
22-
* Register any application services.
23+
* Bootstrap any application services.
2324
*
2425
* @return void
2526
*/
26-
public function register()
27+
public function boot()
2728
{
28-
$this->registerExceptionHandler();
29-
$this->registerTelescope();
29+
//
3030
}
3131

3232
/**

app/Providers/EventServiceProvider.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace App\Providers;
44

5+
use Illuminate\Auth\Events\Registered;
6+
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
57
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
68
use Illuminate\Support\Facades\Event;
79

@@ -13,7 +15,9 @@ class EventServiceProvider extends ServiceProvider
1315
* @var array
1416
*/
1517
protected $listen = [
16-
18+
Registered::class => [
19+
// SendEmailVerificationNotification::class,
20+
],
1721
];
1822

1923
/**

app/Providers/RouteServiceProvider.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ class RouteServiceProvider extends ServiceProvider
1616
*/
1717
protected $namespace = 'App\Http\Controllers';
1818

19+
/**
20+
* The path to the "home" route for your application.
21+
*
22+
* @var string
23+
*/
24+
public const HOME = '/';
25+
1926
/**
2027
* Define your route model bindings, pattern filters, etc.
2128
*
@@ -38,6 +45,7 @@ public function map()
3845
{
3946
$this->mapApiRoutes();
4047

48+
// Re-enable if you would like to add web routes (eg. non-API routes for things like legacy webhook receivers)
4149
//$this->mapWebRoutes();
4250
}
4351

composer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"require": {
1414
"php": "^7.2.5",
1515
"fideloper/proxy": "^4.2",
16+
"fruitcake/laravel-cors": "^1.0",
17+
"guzzlehttp/guzzle": "^6.3",
1618
"laravel/framework": "^7.0",
1719
"laravel/tinker": "^2.4",
1820
"specialtactics/l5-api": "^2.0"
@@ -21,11 +23,11 @@
2123
"barryvdh/laravel-ide-helper": "^2.7",
2224
"beyondcode/laravel-dump-server": "^1.4",
2325
"facade/ignition": "^2.0",
24-
"fzaninotto/faker": "^1.9",
25-
"laravel/telescope": "^3.3",
26-
"mockery/mockery": "^1.0",
27-
"nunomaduro/collision": "^4.2",
28-
"phpunit/phpunit": "^8.5"
26+
"fzaninotto/faker": "^1.9.1",
27+
"mockery/mockery": "^1.3.1",
28+
"nunomaduro/collision": "^4.1",
29+
"phpunit/phpunit": "^8.5",
30+
"laravel/telescope": "^3.3"
2931
},
3032
"config": {
3133
"optimize-autoloader": true,

config/app.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
|
4040
*/
4141

42-
'debug' => env('APP_DEBUG', false),
42+
'debug' => (bool) env('APP_DEBUG', false),
4343

4444
/*
4545
|--------------------------------------------------------------------------
@@ -207,6 +207,7 @@
207207
'File' => Illuminate\Support\Facades\File::class,
208208
'Gate' => Illuminate\Support\Facades\Gate::class,
209209
'Hash' => Illuminate\Support\Facades\Hash::class,
210+
'Http' => Illuminate\Support\Facades\Http::class,
210211
'Lang' => Illuminate\Support\Facades\Lang::class,
211212
'Log' => Illuminate\Support\Facades\Log::class,
212213
'Mail' => Illuminate\Support\Facades\Mail::class,

0 commit comments

Comments
 (0)