Skip to content

Commit

Permalink
Merge pull request #41 from specialtactics/v2
Browse files Browse the repository at this point in the history
Laravel 7 updates
  • Loading branch information
specialtactics authored May 12, 2020
2 parents 9fc57fd + 17ce817 commit 7d6acad
Show file tree
Hide file tree
Showing 27 changed files with 181 additions and 120 deletions.
2 changes: 2 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class Handler extends ExceptionHandler
*
* @param Throwable $exception
* @return void
*
* @throws \Exception
*/
public function report(Throwable $exception)
{
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Kernel extends HttpKernel
*/
protected $middleware = [
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
Expand All @@ -40,7 +41,7 @@ class Kernel extends HttpKernel
'api' => [
'snake_case',
'throttle:60,1',
'bindings',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];

Expand Down
3 changes: 2 additions & 1 deletion app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Http\Middleware;

use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Support\Facades\Auth;

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

return $next($request);
Expand Down
7 changes: 0 additions & 7 deletions app/Http/Middleware/VerifyCsrfToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

class VerifyCsrfToken extends Middleware
{
/**
* Indicates whether the XSRF-TOKEN cookie should be set on the response.
*
* @var bool
*/
protected $addHttpCookie = true;

/**
* The URIs that should be excluded from CSRF verification.
*
Expand Down
9 changes: 9 additions & 0 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ class User extends BaseModel implements
'password', 'remember_token', 'email_verified_at', 'primary_role',
];

/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];

/**
* Model's boot function
*/
Expand Down
14 changes: 7 additions & 7 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
* Register any application services.
*
* @return void
*/
public function boot()
public function register()
{
//
$this->registerExceptionHandler();
$this->registerTelescope();
}

/**
* Register any application services.
* Bootstrap any application services.
*
* @return void
*/
public function register()
public function boot()
{
$this->registerExceptionHandler();
$this->registerTelescope();
//
}

/**
Expand Down
6 changes: 5 additions & 1 deletion app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace App\Providers;

use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;

Expand All @@ -13,7 +15,9 @@ class EventServiceProvider extends ServiceProvider
* @var array
*/
protected $listen = [

Registered::class => [
// SendEmailVerificationNotification::class,
],
];

/**
Expand Down
8 changes: 8 additions & 0 deletions app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ class RouteServiceProvider extends ServiceProvider
*/
protected $namespace = 'App\Http\Controllers';

/**
* The path to the "home" route for your application.
*
* @var string
*/
public const HOME = '/';

/**
* Define your route model bindings, pattern filters, etc.
*
Expand All @@ -38,6 +45,7 @@ public function map()
{
$this->mapApiRoutes();

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

Expand Down
12 changes: 7 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"require": {
"php": "^7.2.5",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^1.0",
"guzzlehttp/guzzle": "^6.3",
"laravel/framework": "^7.0",
"laravel/tinker": "^2.4",
"specialtactics/l5-api": "^2.0"
Expand All @@ -21,11 +23,11 @@
"barryvdh/laravel-ide-helper": "^2.7",
"beyondcode/laravel-dump-server": "^1.4",
"facade/ignition": "^2.0",
"fzaninotto/faker": "^1.9",
"laravel/telescope": "^3.3",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^4.2",
"phpunit/phpunit": "^8.5"
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^8.5",
"laravel/telescope": "^3.3"
},
"config": {
"optimize-autoloader": true,
Expand Down
3 changes: 2 additions & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
|
*/

'debug' => env('APP_DEBUG', false),
'debug' => (bool) env('APP_DEBUG', false),

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -207,6 +207,7 @@
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Http' => Illuminate\Support\Facades\Http::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
Expand Down
1 change: 1 addition & 0 deletions config/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
'throttle' => 60,
],
],

Expand Down
1 change: 1 addition & 0 deletions config/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

'array' => [
'driver' => 'array',
'serialize' => false,
],

'database' => [
Expand Down
34 changes: 34 additions & 0 deletions config/cors.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/

'paths' => ['api/*'],

'allowed_methods' => ['*'],

'allowed_origins' => ['*'],

'allowed_origins_patterns' => [],

'allowed_headers' => ['*'],

'exposed_headers' => [],

'max_age' => 0,

'supports_credentials' => false,

];
8 changes: 4 additions & 4 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,16 @@
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DB', 0),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],

'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_CACHE_DB', 1),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],

],
Expand Down
16 changes: 16 additions & 0 deletions config/filesystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,24 @@
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
],

],

/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/

'links' => [
public_path('storage') => storage_path('app/public'),
],

];
6 changes: 5 additions & 1 deletion config/logging.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['daily'],
'channels' => ['single'],
'ignore_exceptions' => false,
],

Expand Down Expand Up @@ -95,6 +95,10 @@
'driver' => 'monolog',
'handler' => NullHandler::class,
],

'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],

];
Loading

0 comments on commit 7d6acad

Please sign in to comment.