mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
32 lines
732 B
PHP
32 lines
732 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
|
|
class SeedBoxRecord extends NexusModel
|
|
{
|
|
protected $table = 'seedbox_records';
|
|
|
|
protected $fillable = ['type', 'uid', 'operator', 'bandwidth', 'ip', 'ip_begin', 'ip_end', 'ip_begin_numeric', 'ip_end_numeric', 'comment'];
|
|
|
|
public $timestamps = true;
|
|
|
|
const TYPE_USER = 1;
|
|
const TYPE_ADMIN = 2;
|
|
|
|
protected function typeText(): Attribute
|
|
{
|
|
return new Attribute(
|
|
get: fn($value, $attributes) => __("seedbox.type_text." . $attributes['type'])
|
|
);
|
|
}
|
|
|
|
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'uid');
|
|
}
|
|
|
|
|
|
}
|