Files
backend/app/Model/AppKeywordsMonitor.php
2025-06-20 15:27:14 +08:00

52 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Model;
/**
* @property int $id
* @property string $keyword
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property int $deleted_at
* @property int $is_delete
* @property int $platform
* @property string $ignore_url
* @property-read string $queried_at
*/
class AppKeywordsMonitor extends Model
{
/**
* The table associated with the model.
*/
protected ?string $table = 'app_keywords_monitor';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = [];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'integer', 'is_delete' => 'integer', 'queried_at' => 'integer', 'platform' => 'integer'];
function getQueriedAtAttribute($value): string
{
if (!$value) {
return '未查询';
}
return date('Y-m-d H:i:s', intval($value)) ?: '未查询';
}
function getIgnoreUrlAttribute($value)
{
return $this->format('ignore_url', function (bool $isFormat) use ($value) {
return $isFormat ? (($value && is_string($value)) ? json_decode($value, true) : []) : $value;
});
}
}