Added license management module

This commit is contained in:
2026-05-25 22:45:23 +02:00
parent 93b7be7e2c
commit df24d48038
16 changed files with 861 additions and 9 deletions
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use App\Models\License;
class LicenseFactory extends Factory
{
protected $model = License::class;
public function definition()
{
return [
'name' => $this->faker->name(),
'email' => $this->faker->safeEmail(),
'product' => "Tooloop Guide",
'version' => $this->faker->semver(),
'is_perpetual' => rand(0, 10) > 7,
'expiration_date' => $this->faker->dateTimeThisDecade(),
'signature' => $this->faker->sha256()
];
}
}
@@ -0,0 +1,34 @@
<?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::create('licenses', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email');
$table->string('product');
$table->string('version');
$table->boolean('is_perpetual');
$table->string('expiration_date')->nullable();;
$table->string('signature');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('licenses');
}
};
+1
View File
@@ -22,6 +22,7 @@ public function run(): void
SettingsTableSeeder::class,
TodoTypeSeeder::class,
UnitSeeder::class,
LicenseSeeder::class,
]);
$user = User::factory()->create([
+17
View File
@@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\License;
class LicenseSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
License::factory()->count(10)->create();
}
}