Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Commit

Permalink
Upgrade to laravel 9
Browse files Browse the repository at this point in the history
Signed-off-by: Lloric Mayuga Garcia <[email protected]>
  • Loading branch information
lloricode committed Oct 15, 2022
1 parent 0d47a3e commit 19d5daa
Show file tree
Hide file tree
Showing 19 changed files with 3,282 additions and 4,059 deletions.
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ DB_PASSWORD=secret
#MAIL_USERNAME=${APP_NAME}
#MAIL_ENCRYPTION=null

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=[email protected]
MAIL_FROM_NAME="Example app"

CACHE_DRIVER=file
QUEUE_CONNECTION=sync

Expand Down
16 changes: 16 additions & 0 deletions .run/test all.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="test all" type="PestRunConfigurationType">
<CommandLine>
<PhpTestInterpreterSettings>
<option name="interpreterName" value="Remote PHP 8.1" />
</PhpTestInterpreterSettings>
</CommandLine>
<option name="pestRunnerSettings">
<PestRunner directory="$PROJECT_DIR$/tests" method="" />
</option>
<option name="runnerSettings">
<PhpTestRunnerSettings directory="$PROJECT_DIR$/tests" method="" />
</option>
<method v="2" />
</configuration>
</component>
1 change: 0 additions & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class Kernel extends ConsoleKernel
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void
*/
protected function schedule(Schedule $schedule)
Expand Down
4 changes: 2 additions & 2 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class Handler extends ExceptionHandler
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Throwable $exception
*
* @return void
*
* @throws \Exception
*/
public function report(Throwable $exception)
Expand All @@ -51,8 +51,8 @@ public function report(Throwable $exception)
*
* @param \Illuminate\Http\Request $request
* @param \Throwable $exception
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*
* @return \Illuminate\Http\JsonResponse
* @throws \Throwable
*/
public function render($request, Throwable $exception)
Expand Down
7 changes: 3 additions & 4 deletions app/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ class Authenticate
/**
* The authentication guard factory instance.
*
* @var \Illuminate\Contracts\Auth\Factory
*/
protected Auth $auth;

/**
* Create a new middleware instance.
*
* @param \Illuminate\Contracts\Auth\Factory $auth
*
* @return void
*/
public function __construct(Auth $auth)
Expand All @@ -31,15 +31,14 @@ public function __construct(Auth $auth)
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
*
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if ($this->auth->guard($guard)->guest()) {
abort(401, 'Unauthorized');
return response('Unauthorized.', 401);
}

return $next($request);
}
}
}
15 changes: 0 additions & 15 deletions app/Transformers/Auth/PermissionTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,6 @@

class PermissionTransformer extends BaseTransformer
{
/**
* List of resources possible to include
*
* @var array
*/
protected $availableIncludes = [
];
/**
* List of resources to automatically include
*
* @var array
*/
protected $defaultIncludes = [
];

/**
* A Fractal transformer.
*
Expand Down
14 changes: 1 addition & 13 deletions app/Transformers/Auth/RoleTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,7 @@

class RoleTransformer extends BaseTransformer
{
/**
* List of resources possible to include
*
* @var array
*/
protected $availableIncludes = [
];
/**
* List of resources to automatically include
*
* @var array
*/
protected $defaultIncludes = [
protected array $defaultIncludes = [
'permissions',
];

Expand Down
14 changes: 1 addition & 13 deletions app/Transformers/Auth/UserTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,10 @@
*/
class UserTransformer extends BaseTransformer
{
/**
* List of resources possible to include
*
* @var array
*/
protected $availableIncludes = [
protected array $availableIncludes = [
'roles',
'permissions',
];
/**
* List of resources to automatically include
*
* @var array
*/
protected $defaultIncludes = [
];

/**
* A Fractal transformer.
Expand Down
3 changes: 2 additions & 1 deletion app/Transformers/BaseTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Date;
use InvalidArgumentException;
use League\Fractal\Resource\Collection;
use League\Fractal\TransformerAbstract;

abstract class BaseTransformer extends TransformerAbstract
Expand Down Expand Up @@ -102,7 +103,7 @@ protected static function readableTimestamp(string $column, $entity): array
];
}

protected function collection($data, $transformer, $resourceKey = null)
protected function collection($data, $transformer, ?string $resourceKey = null): Collection
{
return parent::collection($data, $transformer, $resourceKey ?: $transformer->getResourceKey());
}
Expand Down
14 changes: 0 additions & 14 deletions app/Transformers/LocalizationTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,6 @@

class LocalizationTransformer extends BaseTransformer
{
/**
* @var array
*/
protected $defaultIncludes = [

];

/**
* @var array
*/
protected $availableIncludes = [

];

/**
* @param Localization $entity
*
Expand Down
2 changes: 1 addition & 1 deletion artisan
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ $kernel = $app->make(
'Illuminate\Contracts\Console\Kernel'
);

exit($kernel->handle(new ArgvInput(), new ConsoleOutput()));
exit($kernel->handle(new ArgvInput, new ConsoleOutput));
12 changes: 10 additions & 2 deletions bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,21 @@
$app->configure('hashids');
$app->configure('helo');
$app->configure('localization');
$app->configure('mail');
$app->configure('permission');
$app->configure('repository');
$app->configure('services');
$app->configure('setting');
$app->configure('swagger-lume');


$app->alias('mail.manager', Illuminate\Mail\MailManager::class);
$app->alias('mail.manager', Illuminate\Contracts\Mail\Factory::class);

$app->alias('mailer', Illuminate\Mail\Mailer::class);
$app->alias('mailer', Illuminate\Contracts\Mail\Mailer::class);
$app->alias('mailer', Illuminate\Contracts\Mail\MailQueue::class);

/*
|--------------------------------------------------------------------------
| Register Middleware
Expand All @@ -92,7 +101,6 @@
$app->middleware(
[
App\Http\Middleware\LocalizationMiddleware::class,
Fruitcake\Cors\HandleCors::class,
]
);

Expand All @@ -117,13 +125,13 @@
|
*/

$app->register(Illuminate\Mail\MailServiceProvider::class);
$app->register(App\Providers\AuthServiceProvider::class);
$app->register(App\Providers\AppServiceProvider::class);
$app->register(App\Providers\RepositoryServiceProvider::class);
$app->register(Coderello\SocialGrant\Providers\SocialGrantServiceProvider::class);
$app->register(Dusterio\LumenPassport\PassportServiceProvider::class);
$app->register(Flipbox\LumenGenerator\LumenGeneratorServiceProvider::class);
$app->register(Fruitcake\Cors\CorsServiceProvider::class);
$app->register(GrahamCampbell\Throttle\ThrottleServiceProvider::class);
$app->register(Laravel\Passport\PassportServiceProvider::class);
$app->register(Laravel\Socialite\SocialiteServiceProvider::class);
Expand Down
25 changes: 13 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,31 @@
"license": "MIT",
"type": "project",
"require": {
"php": "^8.1",
"php": "^8.1.11",
"ext-intl": "*",
"ext-json": "*",
"ext-pdo": "*",
"composer-runtime-api": "^2.0",
"coderello/laravel-passport-social-grant": "^3.0.3",
"darkaonline/swagger-lume": "^8.0",
"darkaonline/swagger-lume": "^9.0",
"dusterio/lumen-passport": "^0.3.4",
"flipbox/lumen-generator": "^8.2.2",
"fruitcake/laravel-cors": "^2.0.4",
"graham-campbell/throttle": "^8.1.1",
"laravel/lumen-framework": "^8.3.1",
"flipbox/lumen-generator": "^9.1",
"graham-campbell/throttle": "^9.0",
"illuminate/mail": "^9.35",
"laravel/lumen-framework": "^9.1.3",
"laravel/passport": "^10.21",
"laravel/socialite": "^5.2.5",
"prettus/l5-repository": "^2.7.9",
"rap2hpoutre/laravel-log-viewer": "^2.0",
"spatie/laravel-fractal": "^5.8.1",
"spatie/laravel-fractal": "^6.0",
"spatie/laravel-permission": "^5.4",
"spatie/laravel-sluggable": "^3.1"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.10",
"beyondcode/helo-laravel": "^1.3",
"beyondcode/tinkerwell-helper": "^1.3",
"doctrine/dbal": "^3.2",
"fakerphp/faker": "^1.13",
"league/flysystem": "^2.3.2",
"mockery/mockery": "^1.4.4",
"pestphp/pest": "^1.21.1",
"spatie/laravel-ray": "^1.26.3",
Expand Down Expand Up @@ -89,16 +87,19 @@
"@php artisan ide-helper:models --reset --write --ansi",
"@php artisan inspire --ansi"
],
"pest": "./vendor/bin/pest",
"pest-coverage": "./vendor/bin/pest --coverage",
"test": "./vendor/bin/pest",
"test-coverage": "./vendor/bin/pest --coverage",
"x-ray": "vendor/bin/x-ray app database resources routes tests"
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true,
"platform": {
"php": "8.1"
"php": "8.1.11"
},
"allow-plugins": {
"pestphp/pest-plugin": true
}
},
"minimum-stability": "dev",
Expand Down
Loading

0 comments on commit 19d5daa

Please sign in to comment.