Skip to content

Commit 8032db3

Browse files
committed
Reigistry prebuilder
1 parent d9a511a commit 8032db3

9 files changed

Lines changed: 2297 additions & 2 deletions

File tree

app/Enums/RegistryType.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace App\Enums;
4+
5+
enum RegistryType: string
6+
{
7+
case Font = 'registry:font';
8+
case Style = 'registry:style';
9+
case Hook = 'registry:hook';
10+
case Ui = 'registry:ui';
11+
case Lib = 'registry:lib';
12+
}

app/Models/Registry.php

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Database\Factories\RegistryFactory;
6+
use Illuminate\Database\Eloquent\Attributes\Fillable;
7+
use Illuminate\Database\Eloquent\Factories\HasFactory;
8+
use Illuminate\Database\Eloquent\Model;
9+
10+
#[Fillable([
11+
'name', 'type', 'title', 'description', 'author',
12+
'dependencies', 'devDependencies', 'registryDependencies',
13+
'files', 'tailwind', 'envVars', 'docs', 'categories',
14+
'extends', 'style', 'iconLibrary', 'baseColor', 'theme',
15+
'meta', 'font', 'css_vars', 'css',
16+
])]
17+
class Registry extends Model
18+
{
19+
/** @use HasFactory<RegistryFactory> */
20+
use HasFactory;
21+
22+
protected $casts = [
23+
'meta' => 'array',
24+
'font' => 'array',
25+
'css_vars' => 'array',
26+
'css' => 'array',
27+
'dependencies' => 'array',
28+
'devDependencies' => 'array',
29+
'registryDependencies' => 'array',
30+
'files' => 'array',
31+
'tailwind' => 'array',
32+
'envVars' => 'array',
33+
'categories' => 'array',
34+
];
35+
36+
public function scopeThemes($query)
37+
{
38+
return $query->where('type', 'registry:theme');
39+
}
40+
41+
public function scopeFonts($query)
42+
{
43+
return $query->where('type', 'registry:font');
44+
}
45+
46+
public function scopeLib($query)
47+
{
48+
return $query->where('type', 'registry:lib');
49+
}
50+
51+
public function scopeUi($query)
52+
{
53+
return $query->where('type', 'registry:ui');
54+
}
55+
56+
public function scopeComponent($query)
57+
{
58+
return $query->where('type', 'registry:component');
59+
}
60+
61+
protected function scopeSearch($query, $search)
62+
{
63+
return $query->where('name', 'like', "%{$search}%");
64+
}
65+
}

bun.lock

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Database\Factories;
4+
5+
use App\Models\Registry;
6+
use Illuminate\Database\Eloquent\Factories\Factory;
7+
8+
/**
9+
* @extends Factory<Registry>
10+
*/
11+
class RegistryFactory extends Factory
12+
{
13+
/**
14+
* Define the model's default state.
15+
*
16+
* @return array<string, mixed>
17+
*/
18+
public function definition(): array
19+
{
20+
return [
21+
//
22+
];
23+
}
24+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('registries', function (Blueprint $table) {
15+
$table->id();
16+
$table->string('name')->unique();
17+
$table->string('type');
18+
$table->string('title')->nullable();
19+
$table->text('description')->nullable();
20+
$table->string('author')->nullable();
21+
$table->json('dependencies')->nullable();
22+
$table->json('devDependencies')->nullable();
23+
$table->json('registryDependencies')->nullable();
24+
$table->longText('files')->nullable();
25+
$table->longText('tailwind')->nullable();
26+
$table->json('envVars')->nullable();
27+
$table->longText('docs')->nullable();
28+
$table->json('categories')->nullable();
29+
$table->string('extends')->nullable();
30+
$table->string('style')->nullable();
31+
$table->string('iconLibrary')->nullable();
32+
$table->string('baseColor')->nullable();
33+
$table->string('theme')->nullable();
34+
$table->json('meta');
35+
$table->json('font')->nullable();
36+
$table->json('css_vars')->nullable();
37+
$table->json('css')->nullable();
38+
$table->timestamps();
39+
});
40+
}
41+
42+
/**
43+
* Reverse the migrations.
44+
*/
45+
public function down(): void
46+
{
47+
Schema::dropIfExists('registries');
48+
}
49+
};

database/seeders/DatabaseSeeder.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@ public function run(): void
1515
{
1616
// User::factory(10)->create();
1717

18+
$this->call([
19+
// PermissionSeeder::class,
20+
RegistrySeeder::class,
21+
]);
22+
23+
1824
User::factory()->create([
19-
'name' => 'Test User',
20-
'email' => 'test@example.com',
25+
'name' => 'Claude Myburgh',
26+
'email' => 'claude@designbycode.co.za',
2127
]);
2228
}
2329
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Database\Seeders;
4+
5+
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
6+
use Illuminate\Database\Seeder;
7+
8+
class RegistrySeeder extends Seeder
9+
{
10+
/**
11+
* Run the database seeds.
12+
*/
13+
public function run(): void
14+
{
15+
//
16+
}
17+
}

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,22 @@
3131
"typescript-eslint": "^8.23.0"
3232
},
3333
"dependencies": {
34+
"@fontsource-variable/caveat": "^5.2.8",
35+
"@fontsource-variable/inter": "^5.2.8",
36+
"@fontsource-variable/pixelify-sans": "^5.2.7",
37+
"@fontsource-variable/playfair-display": "^5.2.8",
38+
"@fontsource-variable/roboto": "^5.2.10",
39+
"@fontsource-variable/work-sans": "^5.2.8",
40+
"@fontsource/bebas-neue": "^5.2.7",
41+
"@fontsource/dm-serif-display": "^5.2.8",
42+
"@fontsource/fira-mono": "^5.2.7",
43+
"@fontsource/great-vibes": "^5.2.8",
44+
"@fontsource/ibm-plex-mono": "^5.2.7",
45+
"@fontsource/ibm-plex-sans": "^5.2.8",
46+
"@fontsource/nerko-one": "^5.2.7",
47+
"@fontsource/orbitron": "^5.2.8",
48+
"@fontsource/poppins": "^5.2.7",
49+
"@fontsource/roboto-slab": "^5.2.8",
3450
"@gsap/react": "^2.1.2",
3551
"@headlessui/react": "^2.2.0",
3652
"@inertiajs/react": "^3.0.0",

0 commit comments

Comments
 (0)