Archived
1
0
Fork 0
This repository has been archived on 2026-06-16. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
wow-raid-bingo/app/Models/Setting.php

50 lines
968 B
PHP

<?php
namespace App\Models;
use Vinkla\Hashids\Facades\Hashids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Prunable;
use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
class Setting extends Model
{
use HasFactory, Prunable;
public $timestamps = false;
public $fillable = [
'value',
];
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'value' => Casts\GameSettingsCaster::class,
];
/**
* Get the prunable model query.
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function prunable()
{
return static::where('created_at', '<', now()->subDay(1));
}
public function getHashAttribute()
{
return Hashids::encode($this->id);
}
public function scopeHash($q, $hash)
{
return $q->where('id', Hashids::decode($hash));
}
}