mirror of
https://github.com/usetrmnl/byos_laravel.git
synced 2026-01-14 15:37:53 +00:00
feat(#17): add commands and jobs to poll, download and update firmware
feat(#17): add commands and jobs to poll, download and update firmware feat(#17): update firmware modal feat(#17): add tests
This commit is contained in:
parent
93aac51182
commit
733f307072
13 changed files with 567 additions and 3 deletions
24
database/factories/FirmwareFactory.php
Normal file
24
database/factories/FirmwareFactory.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Firmware;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class FirmwareFactory extends Factory
|
||||
{
|
||||
protected $model = Firmware::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'version_tag' => $this->faker->word(),
|
||||
'url' => $this->faker->url(),
|
||||
'latest' => $this->faker->boolean(),
|
||||
'storage_location' => $this->faker->word(),
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?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('firmware', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('version_tag');
|
||||
$table->string('url')->nullable();
|
||||
$table->boolean('latest')->default(false);
|
||||
$table->string('storage_location')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('firmware');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?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::table('devices', function (Blueprint $table) {
|
||||
$table->foreignId('update_firmware_id')->nullable()->constrained('firmware')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('devices', function (Blueprint $table) {
|
||||
$table->dropForeign(['update_firmware_id']);
|
||||
$table->dropColumn('update_firmware_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue