Skip to content

Commit

Permalink
Laravel 11 Support
Browse files Browse the repository at this point in the history
  • Loading branch information
tcampbPPU committed Jun 11, 2024
1 parent d9ae8e9 commit e65fecc
Show file tree
Hide file tree
Showing 16 changed files with 6,910 additions and 5,739 deletions.
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

0 comments on commit e65fecc

Please sign in to comment.