add global promotion deadline + fix grane medal

This commit is contained in:
xiaomlove
2022-07-09 18:06:09 +08:00
parent 50759b1cf3
commit afa8cdce99
40 changed files with 1936 additions and 20 deletions

View File

@@ -5,7 +5,12 @@ namespace App\Models;
class TorrentState extends NexusModel
{
public $incrementing = false;
protected $fillable = ['global_sp_state', 'deadline'];
protected $table = 'torrents_state';
public function getGlobalSpStateTextAttribute()
{
return Torrent::$promotionTypes[$this->global_sp_state]['text'] ?? '';
}
}

View File

@@ -17,10 +17,11 @@ use Laravel\Sanctum\HasApiTokens;
use Nexus\Database\NexusDB;
use Filament\Models\Contracts\FilamentUser;
use Filament\Models\Contracts\HasName;
use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable implements FilamentUser, HasName
{
use HasFactory, Notifiable, HasApiTokens;
use HasFactory, Notifiable, HasApiTokens, HasRoles;
public $timestamps = false;
@@ -476,7 +477,7 @@ class User extends Authenticatable implements FilamentUser, HasName
public function canAccessAdmin(): bool
{
$targetClass = self::CLASS_SYSOP;
$targetClass = Setting::get('authority.staffmem');
if (!$this->class || $this->class < $targetClass) {
do_log(sprintf('user: %s, no class or class < %s, can not access admin.', $this->id, $targetClass));
return false;