-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
395ec42
commit 1f52d52
Showing
49 changed files
with
1,899 additions
and
426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Enjin\Platform\Beam\Database\Factories; | ||
|
||
use Enjin\Platform\Beam\Models\BeamPack; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
class BeamPackFactory extends Factory | ||
{ | ||
/** | ||
* The name of the factory's corresponding model. | ||
* | ||
* @var BeamPack | ||
*/ | ||
protected $model = BeamPack::class; | ||
|
||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array<string, mixed> | ||
*/ | ||
public function definition() | ||
{ | ||
return [ | ||
'is_claimed' => fake()->boolean(), | ||
'code' => fake()->text(), | ||
'nonce' => 1, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class () extends Migration { | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::table('beams', function (Blueprint $table) { | ||
$table->boolean('is_pack')->default(false)->index(); | ||
}); | ||
|
||
Schema::create('beam_packs', function (Blueprint $table) { | ||
$table->id(); | ||
$table->foreignId('beam_id')->constrained()->cascadeOnDelete(); | ||
$table->string('code')->index()->nullable(); | ||
$table->unsignedInteger('nonce')->nullable(); | ||
$table->boolean('is_claimed')->default(false)->index(); | ||
$table->softDeletes(); | ||
$table->timestamps(); | ||
}); | ||
|
||
Schema::table('beam_claims', function (Blueprint $table) { | ||
$table->foreignId('beam_pack_id')->index()->nullable()->constrained()->cascadeOnDelete(); | ||
$table->dropUnique(['idempotency_key']); | ||
$table->index(['idempotency_key']); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::table('beams', function (Blueprint $table) { | ||
$table->dropColumn('is_pack'); | ||
}); | ||
Schema::dropIfExists('beam_packs'); | ||
Schema::table('beam_claims', function (Blueprint $table) { | ||
$table->dropColumn('beam_pack_id'); | ||
$table->unique(['idempotency_key']); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
return [ | ||
'claim_union.description' => 'The beam claim can be of either type: BeamPack or BeamClaim', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.