Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 11 Support #122

Merged
merged 5 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/larastan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.1]
php: [8.3]

name: PHP Version:${{ matrix.php }}
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.1]
php: [8.3]

name: PHP Version:${{ matrix.php }}

Expand Down Expand Up @@ -43,4 +43,4 @@ jobs:
run: composer install --prefer-dist --no-suggest --no-progress

- name: Detect coding standard violations
run: vendor/bin/phpcs -q --report=checkstyle | cs2pr --graceful-warnings
run: vendor/bin/pint --test --format=checkstyle | cs2pr
2 changes: 1 addition & 1 deletion .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.1]
php: [8.3]

name: PHP Version:${{ matrix.php }}

Expand Down
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"open-southeners.laravel-pint",
"Vue.volar",
"Vue.vscode-typescript-vue-plugin",
"emeraldwalk.RunOnSave",
]
}
13 changes: 9 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
"prettier.enable": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"[php]": {
"editor.defaultFormatter": "open-southeners.laravel-pint",
"editor.formatOnSave": true
"emeraldwalk.runonsave": {
"commands": [
{
"match": "\\.php$",
"isAsync": true,
"cmd": "./vendor/bin/pint ${file}"
},
]
},
}
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Kernel extends ConsoleKernel
/**
* The Artisan commands provided by your application.
*
* @var array
* @var array<string>
*/
protected $commands = [
//
Expand Down
5 changes: 4 additions & 1 deletion app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Models\Provider;
use App\Models\User;
use App\Notifications\LoginAttempt;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
Expand Down Expand Up @@ -57,7 +58,7 @@ public function callback(string $provider, Request $request): Response

$user = $this->oaHandle($oaUser, $provider);

/** @var User $user */
/** @var Authenticatable $user */
auth()->login($user, $provider);

return $this->response($provider);
Expand Down Expand Up @@ -114,6 +115,8 @@ private function response(string $provider): Response

/**
* Create new users with their initial team
*
* @param array<int, mixed> $payload
*/
private function createUser(string $provider, string $name, string $email, string $avatar, array $payload): User
{
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class Controller extends BaseController
{
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
use MetApi;
use ValidatesRequests;

public function __construct(Request $request)
{
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/SessionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class SessionController extends Controller
public function index(): JsonResponse|Response
{
sleep(1);

return $this->render(Session::whereUserId(auth()->user()?->id)->get());
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/TrustHosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TrustHosts extends Middleware
/**
* Get the host patterns that should be trusted.
*
* @return array
* @return array<int, string|null>
*/
public function hosts()
{
Expand Down
5 changes: 5 additions & 0 deletions app/Models/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
*/
class Provider extends Model
{
/**
* Providers allowed.
*
* @var array<string>
*/
public static array $allowed = ['email', 'google', 'facebook'];

protected $guarded = [];
Expand Down
5 changes: 5 additions & 0 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ class User extends Authenticatable

protected $casts = ['is_sub' => 'boolean'];

/**
* Providers allowed.
*
* @var array<string, array<string, string>>
*/
public array $interfaces = [
'location' => [
'name' => 'api.SessionLocation',
Expand Down
4 changes: 2 additions & 2 deletions app/Notifications/LoginAttempt.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(Attempt $attempt)
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
* @return array<string>
*/
public function via($notifiable)
{
Expand All @@ -51,7 +51,7 @@ public function toMail($notifiable)
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
* @return array<string, mixed>
*/
public function toArray($notifiable)
{
Expand Down
16 changes: 4 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
"composer/composer": "^2.2.1",
"google/apiclient": "^2.11",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^10.0",
"laravel/framework": "^11.0",
"laravel/socialite": "^5.6",
"laravel/tinker": "^2.5"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.5",
"barryvdh/laravel-ide-helper": "^2.8",
"barryvdh/laravel-ide-helper": "^3.0",
"fakerphp/faker": "^1.9.1",
"fumeapp/modeltyper": "^2.2",
"larastan/larastan": "^2.1",
"laravel/pint": "^1.0.0",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"nunomaduro/larastan": "^2.0",
"nunomaduro/collision": "^8.1",
"phpunit/phpunit": "^10.0",
"spatie/laravel-ignition": "^2.0",
"spatie/laravel-ray": "^1.29",
Expand Down Expand Up @@ -73,12 +73,6 @@
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
],
"cs": [
"@php vendor/bin/phpcs"
],
"cs-v": [
"@php vendor/bin/phpcs -s"
],
"stan": [
"vendor/bin/phpstan analyse"
],
Expand All @@ -91,8 +85,6 @@
"post-autoload-dump": "Run after autoloading has been dumped.",
"post-root-package-install": "Run after the root package has been installed.",
"post-create-project-cmd": "Run after the project has been created.",
"cs": "Run the PHP CodeSniffer.",
"cs-v": "Run the PHP CodeSniffer verbosely.",
"stan": "Run the PHPStan analyser.",
"pint": "Run the Pint analyser."
}
Expand Down
Loading
Loading