diff --git a/app/Livewire/Forms/NewScript.php b/app/Livewire/Forms/NewScript.php
new file mode 100644
index 0000000..0be1eb4
--- /dev/null
+++ b/app/Livewire/Forms/NewScript.php
@@ -0,0 +1,33 @@
+validate();
+ auth()->user()->scripts()->create([
+ 'name' => $this->name,
+ 'path' => str($this->path)->remove('.sh')->lower()->kebab()->toString(),
+ 'content' => $this->content
+ ]);
+
+ $this->reset(['name', 'path', 'content']);
+ }
+
+ public function render()
+ {
+ return view('livewire.forms.new-script');
+ }
+}
diff --git a/app/Models/Script.php b/app/Models/Script.php
new file mode 100644
index 0000000..881340a
--- /dev/null
+++ b/app/Models/Script.php
@@ -0,0 +1,20 @@
+ $this->path]);
+ }
+
+ public function contentUrl()
+ {
+ return route('script-content', ['path' => $this->path]);
+ }
+}
diff --git a/app/Models/User.php b/app/Models/User.php
index 3cb5ccb..d914de9 100644
--- a/app/Models/User.php
+++ b/app/Models/User.php
@@ -4,6 +4,7 @@ namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Str;
@@ -55,7 +56,12 @@ class User extends Authenticatable
return Str::of($this->name)
->explode(' ')
->take(2)
- ->map(fn ($word) => Str::substr($word, 0, 1))
+ ->map(fn($word) => Str::substr($word, 0, 1))
->implode('');
}
+
+ public function scripts(): HasMany
+ {
+ return $this->hasMany(Script::class);
+ }
}
diff --git a/database/migrations/2025_07_22_221405_create_scripts_table.php b/database/migrations/2025_07_22_221405_create_scripts_table.php
new file mode 100644
index 0000000..7533c96
--- /dev/null
+++ b/database/migrations/2025_07_22_221405_create_scripts_table.php
@@ -0,0 +1,32 @@
+id();
+ $table->foreignIdFor(User::class);
+ $table->string('name');
+ $table->string('path');
+ $table->longText('content');
+ $table->timestamps();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::dropIfExists('scripts');
+ }
+};
diff --git a/resources/views/components/layouts/app.blade.php b/resources/views/components/layouts/app.blade.php
index 3d15107..6dec043 100644
--- a/resources/views/components/layouts/app.blade.php
+++ b/resources/views/components/layouts/app.blade.php
@@ -1,5 +1,5 @@
-