Skip to content

Commit

Permalink
Update all composer packages and update code to Laravel 8 [API-141]
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhiltri committed Nov 4, 2021
1 parent 918a052 commit 8cbd4e9
Show file tree
Hide file tree
Showing 102 changed files with 4,087 additions and 3,161 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ LOGIN_WHITELIST_IPS='127.0.0.1/32'

ACCESS_WHITELIST_IPS='127.0.0.1/32'

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

# Remove SCOUT_DRIVER's value or replace w/ 'elasticsearch' to activate indexing:
# https://github.com/laravel/scout/issues/34
SCOUT_DRIVER='"null"'
Expand All @@ -27,6 +31,8 @@ CACHE_DRIVER='memcached'
SESSION_DRIVER='memcached'
MEMCACHED_HOST='memcache.test'

FILESYSTEM_DRIVER='local'

# One-time configs on first deploy:
DB_CONNECTION='mysql'
DB_HOST=127.0.0.1
Expand Down Expand Up @@ -124,3 +130,4 @@ GTM_ID=
# For `api-data` dumps:
AWS_DEFAULT_REGION='us-east-1'
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ npm-debug.log
!.env.ci
Envoy.blade.php
.phpunit.result.cache
docker-compose.override.yml
.php_cs.cache
.php_cs

Expand All @@ -30,3 +31,5 @@ dist
config.local.js
basement_dist
/public/docs
/.idea
/.vscode
12 changes: 6 additions & 6 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

namespace App\Exceptions;

use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var array
* @var string[]
*/
protected $dontReport = [
//
Expand All @@ -19,7 +19,7 @@ class Handler extends ExceptionHandler
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
* @var string[]
*/
protected $dontFlash = [
//
Expand All @@ -28,12 +28,12 @@ class Handler extends ExceptionHandler
/**
* Report or log an exception.
*
* @param \Exception $exception
* @param \Throwable $exception
* @return void
*
* @throws \Exception
* @throws \Throwable
*/
public function report(Exception $exception)
public function report(Throwable $exception)
{
if (app()->bound('sentry') && $this->shouldReport($exception)) {
app('sentry')->captureException($exception);
Expand Down
31 changes: 6 additions & 25 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ class Kernel extends HttpKernel
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,

\Aic\Hub\Foundation\Middleware\CORS::class,
\Aic\Hub\Foundation\Middleware\ETagMiddleware::class,
\Aic\Hub\Foundation\Middleware\RedirectTrailingSlash::class,
\App\Http\Middleware\TrailingNewline::class,
Expand All @@ -47,8 +48,9 @@ class Kernel extends HttpKernel
\App\Http\Middleware\DecodeParams::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
'auth:api',
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
// WEB-1929: Enable throttling when ready!
// 'throttle',
// 'throttle:api',
'restrict',
],
];
Expand All @@ -61,10 +63,6 @@ class Kernel extends HttpKernel
* @var array
*/
protected $routeMiddleware = [
// SubstituteBindings is used to autoload models via routes
// https://laracasts.com/discuss/channels/laravel/52-53-model-autoloading-via-routes-stopped-working
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,

'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
Expand All @@ -76,21 +74,4 @@ class Kernel extends HttpKernel
'loginIp' => \App\Http\Middleware\LoginIpMiddleware::class,
];

/**
* The priority-sorted list of middleware.
*
* This forces non-global middleware to always be in the given order.
*
* @var array
*/
protected $middlewarePriority = [
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\Authenticate::class,
\Illuminate\Routing\Middleware\ThrottleRequests::class,
\Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Illuminate\Auth\Middleware\Authorize::class,
\App\Http\Middleware\DecodeParams::class,
];
}
17 changes: 17 additions & 0 deletions app/Http/Middleware/PreventRequestsDuringMaintenance.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;

class PreventRequestsDuringMaintenance extends Middleware
{
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
*/
protected $except = [
//
];
}
1 change: 1 addition & 0 deletions app/Http/Middleware/TrimStrings.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class TrimStrings extends Middleware
* @var array
*/
protected $except = [
'current_password',
'password',
'password_confirmation',
];
Expand Down
20 changes: 20 additions & 0 deletions app/Http/Middleware/TrustHosts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace App\Http\Middleware;

use Illuminate\Http\Middleware\TrustHosts as Middleware;

class TrustHosts extends Middleware
{
/**
* Get the host patterns that should be trusted.
*
* @return array
*/
public function hosts()
{
return [
$this->allSubdomainsOfApplicationUrl(),
];
}
}
4 changes: 2 additions & 2 deletions app/Http/Middleware/TrustProxies.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Storage;
use Fideloper\Proxy\TrustProxies as Middleware;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
use Illuminate\Http\Request;

class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array
* @var array|string|null
*/
protected $proxies = [];

Expand Down
17 changes: 17 additions & 0 deletions app/Http/Middleware/VerifyCsrfToken.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace App\Http\Middleware;

use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;

class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
];
}
3 changes: 2 additions & 1 deletion app/Models/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class BaseModel extends AbstractModel
{

use Transformable, Instancable, Documentable;
use Transformable, Instancable, Documentable, HasFactory;

/**
* The name of the field that the source API provides a last updated timestamp in.
Expand Down
1 change: 1 addition & 0 deletions app/Models/CollectionsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ class CollectionsModel extends BaseModel
protected static $source = 'Collections';

protected $isInCiti = true;

}
10 changes: 10 additions & 0 deletions app/Models/Library/Term.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,14 @@ public static function validateId($id)
{
return preg_match('/[a-z]+[0-9]+/', $id);
}

/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\LibraryTermFactory::new();
}
}
10 changes: 10 additions & 0 deletions app/Models/Mobile/Artwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,14 @@ public function stops()
{
return $this->hasMany('App\Models\Mobile\TourStop', 'mobile_artwork_mobile_id');
}

/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\MobileArtworkFactory::new();
}
}
10 changes: 10 additions & 0 deletions app/Models/Mobile/Sound.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,14 @@ public function introducedTours()
{
return $this->hasMany('App\Models\Mobile\Tour', 'intro_mobile_id');
}

/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\MobileSoundFactory::new();
}
}
10 changes: 10 additions & 0 deletions app/Models/Web/Exhibition.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,14 @@ public function exhibition()
{
return $this->belongsTo('App\Models\Collections\Exhibition', 'datahub_id');
}

/**
* Create a new factory instance for the model.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
protected static function newFactory()
{
return \Database\Factories\WebExhibitionFactory::new();
}
}
2 changes: 1 addition & 1 deletion app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class AuthServiceProvider extends BaseServiceProvider
{
protected $policies = [
'App\Model' => 'App\Policies\ModelPolicy',
'App\Models\Model' => 'App\Policies\ModelPolicy',
];

public function boot()
Expand Down
Loading

0 comments on commit 8cbd4e9

Please sign in to comment.