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

[PLA-1678] Laravel 11 update. #77

Merged
merged 5 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 2 additions & 2 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, gmp, intl, json, mysql, readline, sodium, bcmath, pcov
tools: composer:v2
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup GO
uses: actions/setup-go@v5
Expand All @@ -62,7 +62,7 @@ jobs:
chmod 600 ~/.ssh/id_rsa
composer install --no-interaction --prefer-dist --optimize-autoloader
composer build-sr25519
composer dumpautoload
composer dump-autoload

- name: Run Laravel Pint
run: |
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
}
],
"require": {
"php": "^8.1|^8.2",
"php": "^8.2",
"ext-bcmath": "*",
"ext-json": "*",
"ext-openssl": "*",
"enjin/platform-core": "*",
"phrity/websocket": "^1.0",
"rebing/graphql-laravel": "^9.0.0-rc1",
"rebing/graphql-laravel": "^9.2",
"spatie/laravel-package-tools": "^1.0",
"spatie/laravel-ray": "^1.0"
},
Expand Down Expand Up @@ -73,9 +73,9 @@
"require-dev": {
"dms/phpunit-arraysubset-asserts": "dev-master",
"laravel/pint": "^1.16",
"nunomaduro/collision": "^7.0",
"nunomaduro/larastan": "^2.0",
"orchestra/testbench": "^8.0",
"nunomaduro/collision": "^8.1",
"larastan/larastan": "^2.0",
"orchestra/testbench": "^9.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
return new class() extends Migration
{
/**
* Run the migrations.
*/
Expand Down
3 changes: 2 additions & 1 deletion database/migrations/2022_10_12_115527_create_beams_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
return new class() extends Migration
{
/**
* Run the migrations.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
return new class() extends Migration
{
/**
* Run the migrations.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
return new class() extends Migration
{
/**
* Run the migrations.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
return new class() extends Migration
{
/**
* Run the migrations.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
return new class() extends Migration
{
/**
* Run the migrations.
*/
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<php>
<env name="APP_KEY" value="base64:2fl+Ktvkfl+Fuz4Qp/A75G2RTiWVA/ZoKZvp6fiiM10="/>
<env name="DB_CONNECTION" value="mysql"/>
<env name="CACHE_DRIVER" value="redis"/>
<env name="CACHE_STORE" value="redis"/>
<env name="CHAIN" value="substrate"/>
<env name="NETWORK" value="local"/>
<env name="DAEMON_ACCOUNT" value="0x6a03b1a3d40d7e344dfb27157931b14b59fe2ff11d7352353321fe400e956802"/>
Expand Down
6 changes: 3 additions & 3 deletions src/BeamServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ public function boot()
{
parent::boot();

$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
$this->loadRoutesFrom(__DIR__ . '/../routes/enjin-platform-beam.php');
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
$this->loadRoutesFrom(__DIR__.'/../routes/enjin-platform-beam.php');
}

public function packageRegistered()
{
$this->loadTranslationsFrom(__DIR__ . '/../lang', 'enjin-platform-beam');
$this->loadTranslationsFrom(__DIR__.'/../lang', 'enjin-platform-beam');
}
}
2 changes: 1 addition & 1 deletion src/Channels/PlatformBeamChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class PlatformBeamChannel extends PlatformAppChannel
public function __construct()
{
parent::__construct();
$this->name = 'beam;' . $this->name;
$this->name = 'beam;'.$this->name;
}
}
6 changes: 3 additions & 3 deletions src/Commands/BatchProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ protected function process(): void
$this->info("Total batch completed: {$total}");

$transferedCount = $this->processBatch(BeamType::TRANSFER_TOKEN);
$this->info('Total transfers completed: ' . $transferedCount);
$this->info('Total transfers completed: '.$transferedCount);

$mintedCount = $this->processBatch(BeamType::MINT_ON_DEMAND);
$this->info('Total mints completed: ' . $mintedCount);
$this->info('Total mints completed: '.$mintedCount);
}

/**
Expand Down Expand Up @@ -164,7 +164,7 @@ protected function processBatch(BeamType $type): int
])->toEncodable(),
];
} else {
$key = $claim->token_chain_id . '|' . $claim->collection_id;
$key = $claim->token_chain_id.'|'.$claim->collection_id;
if (isset($createdTokens[$key])) {
// Succeeding claims should be minted. Reassigning claims to the next batch
$claim->update(['beam_batch_id' => $batchId = $this->batch->getNextBatchId($type, $collectionId)]);
Expand Down
2 changes: 1 addition & 1 deletion src/Enums/PlatformBeamCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum PlatformBeamCache: string implements PlatformCacheable
*/
public function key(?string $suffix = null): string
{
return 'enjin-platform:beam:' . $this->value . ($suffix ? ":{$suffix}" : '');
return 'enjin-platform:beam:'.$this->value.($suffix ? ":{$suffix}" : '');
}

/**
Expand Down
4 changes: 1 addition & 3 deletions src/Events/BeamClaimInProgress.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

namespace Enjin\Platform\Beam\Events;

class BeamClaimInProgress extends BeamClaimPending
{
}
class BeamClaimInProgress extends BeamClaimPending {}
2 changes: 1 addition & 1 deletion src/Events/BeamClaimPending.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(array $claim)
);

$this->broadcastChannels = [
new Channel('collection;' . $claim['beam']['collection_chain_id']),
new Channel('collection;'.$claim['beam']['collection_chain_id']),
new PlatformAppChannel(),
new PlatformBeamChannel(),
];
Expand Down
4 changes: 1 addition & 3 deletions src/Events/BeamClaimsComplete.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

namespace Enjin\Platform\Beam\Events;

class BeamClaimsComplete extends BeamClaimPending
{
}
class BeamClaimsComplete extends BeamClaimPending {}
4 changes: 1 addition & 3 deletions src/Events/BeamClaimsFailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

namespace Enjin\Platform\Beam\Events;

class BeamClaimsFailed extends BeamClaimPending
{
}
class BeamClaimsFailed extends BeamClaimPending {}
4 changes: 1 addition & 3 deletions src/Events/BeamDeleted.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

namespace Enjin\Platform\Beam\Events;

class BeamDeleted extends BeamCreated
{
}
class BeamDeleted extends BeamCreated {}
4 changes: 1 addition & 3 deletions src/Events/BeamUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

namespace Enjin\Platform\Beam\Events;

class BeamUpdated extends BeamCreated
{
}
class BeamUpdated extends BeamCreated {}
4 changes: 1 addition & 3 deletions src/Events/TokensRemoved.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

namespace Enjin\Platform\Beam\Events;

class TokensRemoved extends TokensAdded
{
}
class TokensRemoved extends TokensAdded {}
10 changes: 5 additions & 5 deletions src/GraphQL/Traits/HasBeamCommonFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ public function getCommonFields(array $exclude = [], bool $updating = false): ar
$required = $updating ? '' : '!';
$fields = [
'name' => [
'type' => GraphQL::type('String' . $required),
'type' => GraphQL::type('String'.$required),
'description' => __('enjin-platform-beam::mutation.common.args.name'),
],
'description' => [
'type' => GraphQL::type('String' . $required),
'type' => GraphQL::type('String'.$required),
'description' => __('enjin-platform-beam::mutation.common.args.description'),
],
'image' => [
'type' => GraphQL::type('String' . $required),
'type' => GraphQL::type('String'.$required),
'description' => __('enjin-platform-beam::mutation.common.args.image'),
],
'start' => [
'type' => GraphQL::type('DateTime' . $required),
'type' => GraphQL::type('DateTime'.$required),
'description' => __('enjin-platform-beam::mutation.common.args.start'),
],
'end' => [
'type' => GraphQL::type('DateTime' . $required),
'type' => GraphQL::type('DateTime'.$required),
'description' => __('enjin-platform-beam::mutation.common.args.end'),
],
];
Expand Down
6 changes: 2 additions & 4 deletions src/Jobs/ClaimBeam.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ class ClaimBeam implements ShouldQueue
/**
* Create a new job instance.
*/
public function __construct(protected ?array $data)
{
}
public function __construct(protected ?array $data) {}

/**
* Execute the job.
Expand Down Expand Up @@ -68,7 +66,7 @@ public function handle(BatchService $batch, WalletService $wallet): void
} catch (Throwable $e) {
DB::rollBack();

Log::error('ClaimBeamJob: Claim error, message:' . $e->getMessage(), $data);
Log::error('ClaimBeamJob: Claim error, message:'.$e->getMessage(), $data);

throw $e;
} finally {
Expand Down
4 changes: 1 addition & 3 deletions src/Jobs/CreateBeamClaims.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ class CreateBeamClaims implements ShouldQueue
/**
* Create a new job instance.
*/
public function __construct(protected ?Collection $chunk)
{
}
public function __construct(protected ?Collection $chunk) {}

/**
* Execute the job.
Expand Down
4 changes: 1 addition & 3 deletions src/Jobs/CreateClaim.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ class CreateClaim implements ShouldQueue
/**
* Create a new job instance.
*/
public function __construct(protected ?array $claim)
{
}
public function __construct(protected ?array $claim) {}

/**
* Execute the job.
Expand Down
3 changes: 1 addition & 2 deletions src/Jobs/DispatchCreateBeamClaimsJobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class DispatchCreateBeamClaimsJobs implements ShouldQueue
public function __construct(
protected Model $beam,
protected ?array $tokens
) {
}
) {}

/**
* Execute the job.
Expand Down
4 changes: 1 addition & 3 deletions src/Listeners/UpdateClaimCollectionIds.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

class UpdateClaimCollectionIds implements ShouldQueue
{
public function __construct(private readonly BeamClaimService $beamClaimService)
{
}
public function __construct(private readonly BeamClaimService $beamClaimService) {}

/**
* Handle the event.
Expand Down
4 changes: 1 addition & 3 deletions src/Listeners/UpdateClaimStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ class UpdateClaimStatus implements ShouldQueue
/**
* Create new event listener instance.
*/
public function __construct()
{
}
public function __construct() {}

/**
* Handle the event.
Expand Down
4 changes: 1 addition & 3 deletions src/Models/Beam.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use Enjin\Platform\Models\ModelResolver;

class Beam extends ModelResolver
{
}
class Beam extends ModelResolver {}
4 changes: 1 addition & 3 deletions src/Models/BeamBatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use Enjin\Platform\Models\ModelResolver;

class BeamBatch extends ModelResolver
{
}
class BeamBatch extends ModelResolver {}
4 changes: 1 addition & 3 deletions src/Models/BeamClaim.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use Enjin\Platform\Models\ModelResolver;

class BeamClaim extends ModelResolver
{
}
class BeamClaim extends ModelResolver {}
4 changes: 1 addition & 3 deletions src/Models/BeamScan.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use Enjin\Platform\Models\ModelResolver;

class BeamScan extends ModelResolver
{
}
class BeamScan extends ModelResolver {}
2 changes: 0 additions & 2 deletions src/Models/Laravel/Beam.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Cache;
use Staudenmeir\EloquentEagerLimit\HasEagerLimit;

class Beam extends BaseModel
{
use HasEagerLimit;
use HasFactory;
use SoftDeletes;
use Traits\EagerLoadSelectFields;
Expand Down
4 changes: 1 addition & 3 deletions src/Models/Laravel/BeamClaim.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
use Staudenmeir\EloquentEagerLimit\HasEagerLimit;

class BeamClaim extends BaseModel
{
use HasEagerLimit;
use HasFactory;
use HasSingleUseCodeScope;
use MassPrunable;
Expand Down Expand Up @@ -180,7 +178,7 @@ public function prunable()
$query = static::whereHas(
'beam',
fn ($query) => $query->where('end', '<', now()->addDays($days))
->whereRaw('flags_mask & (1 << ' . BeamFlag::PRUNABLE->value . ') != 0')
->whereRaw('flags_mask & (1 << '.BeamFlag::PRUNABLE->value.') != 0')
)->claimable();

// We'll decrement the cache for each beam that has expired claims.
Expand Down
Loading
Loading