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 9.x Shift #109

Merged
merged 25 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d1daf02
Apply Laravel coding style
laravel-shift Feb 9, 2022
7b08b5e
Move `resources/lang` folder
laravel-shift Feb 9, 2022
6c5e7f6
Streamline `$commands` property
laravel-shift Feb 9, 2022
58e772e
Replace deprecated `HEADER_X_FORWARDED_ALL` constant
laravel-shift Feb 9, 2022
1050b41
Shift core files
laravel-shift Feb 9, 2022
922b768
Remove web.config
laravel-shift Feb 9, 2022
a538951
Convert `optional()` to nullsafe operator
laravel-shift Feb 9, 2022
f67d61a
Remove unnecessary `$model` property
laravel-shift Feb 9, 2022
1c266fa
Convert route options to fluent methods
laravel-shift Feb 9, 2022
82cc2ce
Shift to class based routes
laravel-shift Feb 9, 2022
86d7023
Convert deprecated `$dates` property to `$casts`
laravel-shift Feb 9, 2022
dfecdd7
Shift config files
laravel-shift Feb 9, 2022
6183e3b
Default config files
laravel-shift Feb 9, 2022
04bbaa9
Bump Laravel dependencies
laravel-shift Feb 9, 2022
ba340a0
Use `<env>` tags for configuration
laravel-shift Feb 9, 2022
98d1708
Adopt anonymous migrations
laravel-shift Feb 9, 2022
853bcd9
Shift cleanup
laravel-shift Feb 9, 2022
9c8b6a9
Prettified Code!
DanielRTRD Feb 9, 2022
3adfb86
Update auth.php
dsbilling Feb 9, 2022
f92a73f
Update validation.php
dsbilling Feb 9, 2022
baa7bd0
Update scribe partials
dsbilling Feb 9, 2022
746f796
Prettified Code!
DanielRTRD Feb 9, 2022
6352db5
Update .prettierrc
dsbilling Feb 9, 2022
3dc87fe
Merge branch 'shift-55308' of https://github.com/P3D-Legacy/pokemon3d…
dsbilling Feb 9, 2022
0d80488
Prettified Code!
DanielRTRD Feb 9, 2022
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
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"useTabs": false,
"semi": true,
"trailingComma": "all",
"singleQuote": true
"singleQuote": true,
"printWidth": 120
}
3 changes: 1 addition & 2 deletions app/Achievements/User/AssociatedDiscord.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace App\Achievements\User;
Expand All @@ -7,8 +8,6 @@

/**
* Class Registered
*
* @package App\Achievements\User
*/
class AssociatedDiscord extends Achievement
{
Expand Down
3 changes: 1 addition & 2 deletions app/Achievements/User/AssociatedFacebook.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace App\Achievements\User;
Expand All @@ -7,8 +8,6 @@

/**
* Class Registered
*
* @package App\Achievements\User
*/
class AssociatedFacebook extends Achievement
{
Expand Down
3 changes: 1 addition & 2 deletions app/Achievements/User/AssociatedGamejolt.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace App\Achievements\User;
Expand All @@ -7,8 +8,6 @@

/**
* Class Registered
*
* @package App\Achievements\User
*/
class AssociatedGamejolt extends Achievement
{
Expand Down
3 changes: 1 addition & 2 deletions app/Achievements/User/AssociatedTwitch.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace App\Achievements\User;
Expand All @@ -7,8 +8,6 @@

/**
* Class Registered
*
* @package App\Achievements\User
*/
class AssociatedTwitch extends Achievement
{
Expand Down
3 changes: 1 addition & 2 deletions app/Achievements/User/AssociatedTwitter.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace App\Achievements\User;
Expand All @@ -7,8 +8,6 @@

/**
* Class Registered
*
* @package App\Achievements\User
*/
class AssociatedTwitter extends Achievement
{
Expand Down
20 changes: 3 additions & 17 deletions app/Actions/Fortify/CreateNewUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,10 @@ public function create(array $input)
{
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
'username' => [
'required',
'string',
'max:255',
'different:email',
'unique:users',
],
'email' => [
'required',
'string',
'email',
'max:255',
'unique:users',
],
'username' => ['required', 'string', 'max:255', 'different:email', 'unique:users'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => $this->passwordRules(),
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature()
? ['required', 'accepted']
: '',
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['required', 'accepted'] : '',
])->validate();

$user = User::create([
Expand Down
12 changes: 2 additions & 10 deletions app/Actions/Fortify/UpdateUserPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,10 @@ public function update($user, array $input)
'password' => $this->passwordRules(),
])
->after(function ($validator) use ($user, $input) {
if (
!isset($input['current_password']) ||
!Hash::check($input['current_password'], $user->password)
) {
if (!isset($input['current_password']) || !Hash::check($input['current_password'], $user->password)) {
$validator
->errors()
->add(
'current_password',
__(
'The provided password does not match your current password.'
)
);
->add('current_password', __('The provided password does not match your current password.'));
}
})
->validateWithBag('updatePassword');
Expand Down
30 changes: 6 additions & 24 deletions app/Actions/Fortify/UpdateUserProfileInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use App\Rules\OlderThan;
use App\Rules\YoungerThan;
use Illuminate\Validation\Rule;
use Illuminate\Support\Facades\Validator;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;

class UpdateUserProfileInformation implements UpdatesUserProfileInformation
Expand All @@ -22,38 +22,20 @@ public function update($user, array $input)
{
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
'username' => [
'required',
'string',
'max:255',
Rule::unique('users')->ignore($user->id),
],
'email' => [
'required',
'email',
'max:255',
Rule::unique('users')->ignore($user->id),
],
'username' => ['required', 'string', 'max:255', Rule::unique('users')->ignore($user->id)],
'email' => ['required', 'email', 'max:255', Rule::unique('users')->ignore($user->id)],
'gender' => ['required', 'numeric'],
'location' => ['nullable', 'max:255'],
'about' => ['nullable', 'max:255'],
'birthdate' => [
'required',
'date_format:Y-m-d',
new OlderThan(),
new YoungerThan(),
],
'birthdate' => ['required', 'date_format:Y-m-d', new OlderThan(), new YoungerThan()],
'photo' => ['nullable', 'mimes:jpg,jpeg,png', 'max:1024'],
])->validateWithBag('updateProfileInformation');

if (isset($input['photo'])) {
$user->updateProfilePhoto($input['photo']);
}

if (
$input['email'] !== $user->email &&
$user instanceof MustVerifyEmail
) {
if ($input['email'] !== $user->email && $user instanceof MustVerifyEmail) {
$this->updateVerifiedUser($user, $input);
} else {
$user
Expand Down
1 change: 0 additions & 1 deletion app/Console/Commands/PingAllServers.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,5 @@ public function handle()
Artisan::call('server:ping ' . $server->uuid);
}
$this->info('All servers have been pinged.');
return;
}
}
17 changes: 4 additions & 13 deletions app/Console/Commands/PingServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,13 @@ public function handle()
$server = Server::find($server_uuid);
if (!$server) {
$this->error('Server not found.');

return;
}

$starttime = microtime(true);
// supress error messages with @
$connection = @fsockopen(
$server->host,
$server->port,
$errno,
$errstr,
2
);
$connection = @fsockopen($server->host, $server->port, $errno, $errstr, 2);
$stoptime = microtime(true);
$ping = 0;

Expand All @@ -72,16 +67,12 @@ public function handle()
$server->last_online_at = now();
$server->active = true;
}
if (
!$reactivate &&
!$ping &&
!$server->official &&
$server->last_online_at < now()->subHours(24)
) {
if (!$reactivate && !$ping && !$server->official && $server->last_online_at < now()->subHours(24)) {
$server->active = false;
}
$server->save();
$this->info('Name: ' . $server->name . ' - Ping: ' . $ping . 'ms');

return $ping;
}
}
13 changes: 3 additions & 10 deletions app/Console/Commands/SkinUserUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Console\Commands;

use App\Models\Skin;
use App\Models\GamejoltAccount;
use App\Models\Skin;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

Expand Down Expand Up @@ -46,16 +46,9 @@ public function handle()
if ($gja) {
$skin->update(['user_id' => $gja->user_id]);
$this->info('Skin #' . $skin->id . ' updated.');
$rows = DB::select(
'SELECT * FROM likes WHERE user_id = ' . $skin->owner_id
);
$rows = DB::select('SELECT * FROM likes WHERE user_id = ' . $skin->owner_id);
foreach ($rows as $row) {
DB::update(
'UPDATE likes SET user_id = ' .
$gja->user_id .
' WHERE user_id = ' .
$skin->owner_id
);
DB::update('UPDATE likes SET user_id = ' . $gja->user_id . ' WHERE user_id = ' . $skin->owner_id);
$this->info('Like #' . $row->id . ' updated.');
}
}
Expand Down
6 changes: 2 additions & 4 deletions app/Console/Commands/SyncGameVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function handle()
$api_url = env('GITHUB_API_REPO');
if (!$api_url) {
$this->error('GitHub API URL is not set.');

return 1;
}
$release_url = env('GITHUB_API_REPO') . '/releases';
Expand All @@ -56,10 +57,7 @@ public function handle()
'page_url' => $release['html_url'],
'download_url' => $release['assets'][0]['browser_download_url'],
];
$version = GameVersion::updateOrCreate(
['version' => $release['tag_name']],
$data
);
$version = GameVersion::updateOrCreate(['version' => $release['tag_name']], $data);
$this->info('Updated or created release: ' . $version->version);
}
$this->info('Done.');
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace App\Console\Commands;

use anlutro\LaravelSettings\Facade as Setting;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use anlutro\LaravelSettings\Facade as Setting;

class Update extends Command
{
Expand Down
29 changes: 8 additions & 21 deletions app/Console/Commands/UpdateGamejoltAccountTrophies.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

use App\Http\Livewire\Login\GameJolt;
use App\Models\GamejoltAccount;
use Illuminate\Console\Command;
use Harrk\GameJoltApi\Exceptions\TimeOutException;
use Harrk\GameJoltApi\GamejoltApi;
use Harrk\GameJoltApi\GamejoltConfig;
use Harrk\GameJoltApi\Exceptions\TimeOutException;
use Illuminate\Console\Command;

class UpdateGamejoltAccountTrophies extends Command
{
Expand Down Expand Up @@ -42,25 +42,14 @@ public function __construct()
*/
public function handle()
{
$api = new GamejoltApi(
new GamejoltConfig(
env('GAMEJOLT_GAME_ID'),
env('GAMEJOLT_GAME_PRIVATE_KEY')
)
);
$api = new GamejoltApi(new GamejoltConfig(env('GAMEJOLT_GAME_ID'), env('GAMEJOLT_GAME_PRIVATE_KEY')));
$accounts = GamejoltAccount::all();
foreach ($accounts as $account) {
try {
$trophies = $api
->trophies()
->fetch($account->username, $account->token);
if (
filter_var(
$trophies['response']['success'],
FILTER_VALIDATE_BOOLEAN
) === false
) {
$trophies = $api->trophies()->fetch($account->username, $account->token);
if (filter_var($trophies['response']['success'], FILTER_VALIDATE_BOOLEAN) === false) {
$this->error("No success for {$account->username}");

return;
}
$trophies = $trophies['response']['trophies'];
Expand All @@ -77,10 +66,7 @@ public function handle()
'difficulty' => $trophy['difficulty'],
'description' => $trophy['description'],
'image_url' => $trophy['image_url'],
'achieved' => filter_var(
$trophy['achieved'],
FILTER_VALIDATE_BOOLEAN
),
'achieved' => filter_var($trophy['achieved'], FILTER_VALIDATE_BOOLEAN),
]
);
}
Expand All @@ -92,6 +78,7 @@ public function handle()
}
}
$this->info('Done.');

return Command::SUCCESS;
}
}
11 changes: 1 addition & 10 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,11 @@
namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Spatie\Health\Commands\RunHealthChecksCommand;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Spatie\Health\Commands\RunHealthChecksCommand;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];

/**
* Define the application's command schedule.
*
Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace App\Exceptions;

use Throwable;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Throwable;

class Handler extends ExceptionHandler
{
Expand Down
Loading