<?php

declare(strict_types=1);

namespace App\Model;



/**
 * @property int $id 
 * @property string $title 
 * @property string $keywords 
 * @property string $content 
 * @property string $description 
 * @property int $created_by 
 * @property \Carbon\Carbon $updated_at 
 * @property int $updated_by 
 * @property int $deleted_at 
 * @property int $deleted_by 
 * @property int $platform 
 * @property int $is_record 
 * @property string $cover 
 * @property int $is_delete 
 * @property string $source_url 
 * @property string $source_platform 
 * @property int $column_tag 
 * @property int $second_column 
 * @property-read mixed $created_at 
 */
class AppNews extends Model
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'app_news';

    /**
     * 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', 'created_by' => 'integer', 'updated_at' => 'datetime', 'updated_by' => 'integer', 'deleted_at' => 'integer', 'deleted_by' => 'integer', 'platform' => 'integer', 'is_record' => 'integer', 'is_delete' => 'integer', 'column_tag' => 'integer', 'second_column' => 'integer'];

    protected ?string $dateFormat = 'U';

    public function getCreatedAtAttribute($value)
    {
        return $this->format('created_at', function (bool $isFormat) use ($value) {
            return $isFormat ? date('Y-m-d', intval($value)) : $value;
        });
    }
}
