-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
15 changed files
with
858 additions
and
33 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
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,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* Playground | ||
*/ | ||
namespace Database\Factories\Playground\Test\Models; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use Illuminate\Support\Str; | ||
use Playground\Test\Models\Demo; | ||
|
||
/** | ||
* \Database\Factories\Playground\Test\Models\DemoFactory | ||
* | ||
* @extends Factory<Demo> | ||
*/ | ||
class DemoFactory extends Factory | ||
{ | ||
/** | ||
* The name of the factory's corresponding model. | ||
* | ||
* @var class-string<Demo> | ||
*/ | ||
protected $model = Demo::class; | ||
|
||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array<string, mixed> | ||
*/ | ||
public function definition(): array | ||
{ | ||
$title = $this->faker->sentence(3); | ||
|
||
return [ | ||
'label' => $this->faker->sentence(3), | ||
'title' => $title, | ||
'slug' => Str::slug($title, '-'), | ||
'description' => $this->faker->sentence(3), | ||
'introduction' => $this->faker->sentence(3), | ||
'content' => $this->faker->sentence(3), | ||
'summary' => $this->faker->sentence(3), | ||
]; | ||
} | ||
} |
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,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* Playground | ||
*/ | ||
namespace Database\Factories\Playground\Test\Models; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use Illuminate\Support\Str; | ||
use Playground\Test\Models\Widget; | ||
|
||
/** | ||
* \Database\Factories\Playground\Test\Models\WidgetFactory | ||
* | ||
* @extends Factory<Widget> | ||
*/ | ||
class WidgetFactory extends Factory | ||
{ | ||
/** | ||
* The name of the factory's corresponding model. | ||
* | ||
* @var class-string<Widget> | ||
*/ | ||
protected $model = Widget::class; | ||
|
||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array<string, mixed> | ||
*/ | ||
public function definition(): array | ||
{ | ||
$title = $this->faker->sentence(3); | ||
|
||
return [ | ||
'label' => $this->faker->sentence(3), | ||
'title' => $title, | ||
'slug' => Str::slug($title, '-'), | ||
'description' => $this->faker->sentence(3), | ||
'introduction' => $this->faker->sentence(3), | ||
'content' => $this->faker->sentence(3), | ||
'summary' => $this->faker->sentence(3), | ||
]; | ||
} | ||
} |
118 changes: 118 additions & 0 deletions
118
database/migrations-testing/9999_00_00_100001_create_testing_demo_table.php
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,118 @@ | ||
<?php | ||
/** | ||
* Playground | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Query\Expression; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
/** | ||
* \Playground\Matrix\Models\Tag | ||
*/ | ||
return new class() extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::create('testing_demo', function (Blueprint $table) { | ||
|
||
// Primary key | ||
|
||
$table->uuid('id')->primary(); | ||
|
||
// IDs | ||
|
||
$table->uuid('created_by_id')->nullable()->index(); | ||
$table->uuid('modified_by_id')->nullable()->index(); | ||
$table->uuid('owned_by_id')->nullable()->index(); | ||
$table->uuid('parent_id')->nullable()->index(); | ||
$table->string('demo_type')->nullable()->index(); | ||
|
||
// Dates | ||
|
||
$table->timestamps(); | ||
|
||
$table->softDeletes(); | ||
|
||
// Permissions | ||
|
||
$table->bigInteger('gids')->default(0)->unsigned(); | ||
$table->tinyInteger('po')->default(0)->unsigned(); | ||
$table->tinyInteger('pg')->default(0)->unsigned(); | ||
$table->tinyInteger('pw')->default(0)->unsigned(); | ||
$table->boolean('only_admin')->default(0); | ||
$table->boolean('only_user')->default(0); | ||
$table->boolean('only_guest')->default(0); | ||
$table->boolean('allow_public')->default(0); | ||
|
||
// Status | ||
|
||
$table->bigInteger('status')->default(0)->unsigned(); | ||
$table->bigInteger('rank')->default(0); | ||
$table->bigInteger('size')->default(0); | ||
|
||
// Matrix | ||
|
||
$table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); | ||
$table->bigInteger('x')->nullable(); | ||
$table->bigInteger('y')->nullable(); | ||
$table->bigInteger('z')->nullable(); | ||
$table->decimal('r', 65, 10)->nullable(); | ||
$table->decimal('theta', 10, 6)->nullable(); | ||
$table->decimal('rho', 10, 6)->nullable(); | ||
$table->decimal('phi', 10, 6)->nullable(); | ||
$table->decimal('elevation', 65, 10)->nullable(); | ||
$table->decimal('latitude', 8, 6)->nullable(); | ||
$table->decimal('longitude', 9, 6)->nullable(); | ||
|
||
// Flags | ||
|
||
$table->boolean('active')->default(1)->index(); | ||
$table->boolean('flagged')->default(0); | ||
$table->boolean('internal')->default(0); | ||
$table->boolean('locked')->default(0); | ||
$table->boolean('unknown')->default(0); | ||
|
||
// Columns | ||
|
||
$table->string('label', 128)->default(''); | ||
$table->string('title', 255)->default(''); | ||
$table->string('byline', 255)->default(''); | ||
$table->string('slug', 128)->nullable()->index(); | ||
$table->string('url', 512)->default(''); | ||
$table->string('description', 512)->default(''); | ||
$table->string('introduction', 512)->default(''); | ||
$table->mediumText('content')->nullable(); | ||
$table->mediumText('summary')->nullable(); | ||
|
||
// Ui | ||
|
||
$table->string('icon', 128)->default(''); | ||
$table->string('image', 512)->default(''); | ||
$table->string('avatar', 512)->default(''); | ||
$table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); | ||
|
||
// JSON | ||
|
||
$table->json('assets')->nullable()->default(new Expression('(JSON_OBJECT())')); | ||
$table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); | ||
$table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); | ||
$table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); | ||
$table->json('sources')->nullable()->default(new Expression('(JSON_OBJECT())')); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::dropIfExists('testing_demo'); | ||
} | ||
}; |
119 changes: 119 additions & 0 deletions
119
database/migrations-testing/9999_00_00_100001_create_testing_widgets.php
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,119 @@ | ||
<?php | ||
/** | ||
* Playground | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Query\Expression; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
/** | ||
* \Playground\Matrix\Models\Tag | ||
*/ | ||
return new class() extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::create('testing_widgets', function (Blueprint $table) { | ||
|
||
// Primary key | ||
|
||
$table->uuid('id')->primary(); | ||
|
||
// IDs | ||
|
||
$table->uuid('created_by_id')->nullable()->index(); | ||
$table->uuid('modified_by_id')->nullable()->index(); | ||
$table->uuid('owned_by_id')->nullable()->index(); | ||
$table->uuid('parent_id')->nullable()->index(); | ||
$table->string('widget_type')->nullable()->index(); | ||
$table->uuid('demo_id')->nullable()->index(); | ||
|
||
// Dates | ||
|
||
$table->timestamps(); | ||
|
||
$table->softDeletes(); | ||
|
||
// Permissions | ||
|
||
$table->bigInteger('gids')->default(0)->unsigned(); | ||
$table->tinyInteger('po')->default(0)->unsigned(); | ||
$table->tinyInteger('pg')->default(0)->unsigned(); | ||
$table->tinyInteger('pw')->default(0)->unsigned(); | ||
$table->boolean('only_admin')->default(0); | ||
$table->boolean('only_user')->default(0); | ||
$table->boolean('only_guest')->default(0); | ||
$table->boolean('allow_public')->default(0); | ||
|
||
// Status | ||
|
||
$table->bigInteger('status')->default(0)->unsigned(); | ||
$table->bigInteger('rank')->default(0); | ||
$table->bigInteger('size')->default(0); | ||
|
||
// Matrix | ||
|
||
$table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); | ||
$table->bigInteger('x')->nullable(); | ||
$table->bigInteger('y')->nullable(); | ||
$table->bigInteger('z')->nullable(); | ||
$table->decimal('r', 65, 10)->nullable(); | ||
$table->decimal('theta', 10, 6)->nullable(); | ||
$table->decimal('rho', 10, 6)->nullable(); | ||
$table->decimal('phi', 10, 6)->nullable(); | ||
$table->decimal('elevation', 65, 10)->nullable(); | ||
$table->decimal('latitude', 8, 6)->nullable(); | ||
$table->decimal('longitude', 9, 6)->nullable(); | ||
|
||
// Flags | ||
|
||
$table->boolean('active')->default(1)->index(); | ||
$table->boolean('flagged')->default(0); | ||
$table->boolean('internal')->default(0); | ||
$table->boolean('locked')->default(0); | ||
$table->boolean('unknown')->default(0); | ||
|
||
// Columns | ||
|
||
$table->string('label', 128)->default(''); | ||
$table->string('title', 255)->default(''); | ||
$table->string('byline', 255)->default(''); | ||
$table->string('slug', 128)->nullable()->index(); | ||
$table->string('url', 512)->default(''); | ||
$table->string('description', 512)->default(''); | ||
$table->string('introduction', 512)->default(''); | ||
$table->mediumText('content')->nullable(); | ||
$table->mediumText('summary')->nullable(); | ||
|
||
// Ui | ||
|
||
$table->string('icon', 128)->default(''); | ||
$table->string('image', 512)->default(''); | ||
$table->string('avatar', 512)->default(''); | ||
$table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); | ||
|
||
// JSON | ||
|
||
$table->json('assets')->nullable()->default(new Expression('(JSON_OBJECT())')); | ||
$table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); | ||
$table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); | ||
$table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); | ||
$table->json('sources')->nullable()->default(new Expression('(JSON_OBJECT())')); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
Schema::dropIfExists('testing_widgets'); | ||
} | ||
}; |
Oops, something went wrong.