Added license management module
This commit is contained in:
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -22,6 +22,7 @@ public function run(): void
|
||||
SettingsTableSeeder::class,
|
||||
TodoTypeSeeder::class,
|
||||
UnitSeeder::class,
|
||||
LicenseSeeder::class,
|
||||
]);
|
||||
|
||||
$user = User::factory()->create([
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user