initial commit

This commit is contained in:
Benjamin Nussbaum 2025-02-12 22:15:57 +01:00
parent 32d63c09e7
commit 01655b413e
37 changed files with 2564 additions and 283 deletions

View file

@ -0,0 +1,27 @@
<?php
namespace Database\Factories;
use App\Models\Device;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
use Illuminate\Support\Str;
class DeviceFactory extends Factory
{
protected $model = Device::class;
public function definition(): array
{
return [
'name' => $this->faker->firstName().' TRMNL',
'mac_address' => $this->faker->macAddress(),
'default_refresh_interval' => '900',
'friendly_id' => Str::random(6),
'api_key' => 'tD-'.Str::random(19),
'user_id' => 1,
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
];
}
}

View file

@ -0,0 +1,33 @@
<?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('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};

View file

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('devices', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->string('mac_address');
$table->integer('default_refresh_interval')->default(900);
$table->string('friendly_id')->nullable();
$table->string('api_key')->nullable();
$table->integer('last_rssi_level')->nullable();
$table->double('last_battery_voltage')->nullable();
$table->string('last_firmware_version')->nullable();
$table->string('current_screen_image')->nullable();
$table->unsignedBigInteger('user_id')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('devices');
}
};