first commit

This commit is contained in:
2025-11-21 17:15:27 +08:00
commit c7cbe7edb7
152 changed files with 17423 additions and 0 deletions

16
app/Models/AppConfig.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class AppConfig extends Model
{
protected $fillable = [
'key',
'value',
'group',
'type',
];
}

28
app/Models/Machine.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Machine extends Model
{
protected $fillable = [
'name',
'location',
'status',
'temperature',
'firmware_version',
'last_heartbeat_at',
];
protected $casts = [
'last_heartbeat_at' => 'datetime',
];
public function logs()
{
return $this->hasMany(MachineLog::class);
}
}

25
app/Models/MachineLog.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class MachineLog extends Model
{
protected $fillable = [
'machine_id',
'level',
'message',
'context',
];
protected $casts = [
'context' => 'array',
];
public function machine()
{
return $this->belongsTo(Machine::class);
}
}

48
app/Models/User.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
'phone',
'avatar',
'role',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}