<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Carbon\Carbon;
use Cviebrock\EloquentSluggable\Sluggable;
use Illuminate\Database\Eloquent\Model;

/**
 * Class SySetting
 *
 * @property int $id
 * @property string $name
 * @property string $slug
 * @property string $message
 * @property string $action
 * @property int $status
 * @property bool $active
 * @property Carbon $created_at
 * @property Carbon $updated_at
 * @package App\Models
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting findSimilarSlugs($attribute, $config, $slug)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereAction($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereActive($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereMessage($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereSlug($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\SySetting whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class SySetting extends Model
{
    use Sluggable;

    protected $table = 'sy_settings';

	protected $casts = [
		'status' => 'int',
		'active' => 'bool'
	];

	protected $fillable = [
		'name',
		'slug',
		'message',
		'action',
		'status',
		'active'
	];

    public static $statusTypes = [
        1 => 'default',
    ];

    public function sluggable()
    {
        return [
            'slug' => [
                'source' => 'name'
            ]
        ];
    }

    public function getStatusType(){
        return isset(self::$statusTypes[$this->status]) ? self::$statusTypes[$this->status] : "";
    }
}
