WowPress-Tailwind/theme/wowpress/Models/SKS.php

42 lines
882 B
PHP
Raw Normal View History

2024-04-22 15:38:22 +02:00
<?php
namespace WoWPress\Models;
use Wenprise\Eloquent\Model;
use WoWPress\Api\BattleNet;
class SKS extends Model
{
protected $table = "wowpress_sks";
public $timestamps = false;
protected $primaryKey = 'ID';
protected $guarded = ['ID'];
public static function getList($name){
return static::where('list_name',$name)->orderBy('rank')->get();
}
public static function getLists(){
return static::distinct('list_name')->get();
}
2024-04-23 00:44:42 +02:00
public function getCharacterAttribute(){
$char= Character::where('name',$this->char_name)->where('realm',$this->realm_name)->first();
if(!empty($char->ID)){
return $char;
}
$char = new Character();
$char->name = $this->char_name;
$char->realm = $this->realm_name;
$char->class = "yellow";
return $char;
}
2024-04-22 15:38:22 +02:00
}