<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
use Illuminate\Database\Eloquent\SoftDeletes;
use Carbon\Carbon;

class CryptoNewsDraft extends Model
{
    use SoftDeletes;
    /**
     * Table name
     */
    protected $table = 'crypto_news_draft';

    /**
     * Mass-assignable attributes
     */
    protected $fillable = [
        'author_id',
        'author_name',
        'user_id',
        'is_gabbar',
        'is_featured',
        'channel_id',
        'is_home',
        'title',
        'alias',
        'interlink_id',
        'h1_title',
        'h2_title',
        'short_desc',
        'description',
        'url',
        'image',
        'img_alt_title',
        'is_thumb',
        'urlToImage',
        'word_file',
        'key_takeaways_json',
        'lang',
        'tags',
        'status',
        'is_active',
        'coin_id',
        'unique_name',
        'is_rss_feed',
        'is_news_blog',
        'is_paid',
        'is_organic',
        'is_cryptotax',
        'is_seo_check',
        'publishedAt',
        'focus_keyword',
        'seo_title',
        'meta_keywords',
        'meta_description',
        'likes_counts',
        'other_status',
        'article',
        'breadcrumbs',
        'course_info',
        'data_set',
        'discussion_forum',
        'events',
        'faq',
        'image_metadata',
        'project_name',
        'project_website',
        'new_article',
        'paywalled_content',
        'product',
        'profile',
        'organization',
        'review_snippets',
        'sitelinks',
        'video',
        'dynamic_rss_feed',
        'dataset_level',
        'dataset_json',
        'update_status',
        'faqs',
        'prompt_instructions'
    ];

    /**
     * Relationships
     */
    public function postAuthor()
    {
        return $this->hasOne(\App\Models\Authormodel::class, 'id', 'author_id')
            ->select('id', 'user_id', 'slug', 'dispaly_name', 'about_us');
    }

    public function createdBy()
    {
        return $this->hasOne(\App\Models\User::class, 'id', 'created_by');
    }

}
