<?php

namespace App;

class Fortunemethod extends BaseModel
{
    protected $table = 'fortune_methods';

    protected $appends = ['fortuneCount'];

    protected $fillable = ['id', 'name', 'slug', 'description', 'top_name', 'logo', 'order', 'show_top', 'is_activated', 'is_deleted', 'created_at', 'updated_at'];

    public function detail()
    {
        return $this->hasMany(FortunemethodDetail::class, 'fortune_method_id', 'id');
    }

    public function getFortuneCountAttribute() {
        return $this->detail()->count();
    }
}
