<?php

/**
 * Form Question Option Class.
 *
 * This code is used to process Form Questions answer Options
 *
 * @category Forms
 *
 * @author mtc. Martins Fridenbergs <martins.fridenbergs@mtcmedia.co.uk>
 */
namespace Mtc\Modules\FormBuilder\Classes;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Schema;

/**
 * Form Question Option Class. Defines Form Question Option model.
 * Stores option values for choice based Questions.
 *
 * @category Forms
 *
 * @author mtc. Martins Fridenbergs <martins.fridenbergs@mtcmedia.co.uk>
 */
class FormQuestionOption extends Model
{
    /**
     * @var string Classes associated table
     */
    protected $table = 'forms_questions_options';

    /**
     * @var bool Disables use of eloquent timestamps
     */
    public $timestamps = false;

    /**
     * FormQuestionOption::getEmpty().
     *
     * Creates a dummy data array for Vue to process.
     * Eloquent doesn't give out object columns unless it is saved.
     * This function gets object columns and adds relations as empty arrays;
     *
     * @access public
     * @static
     * @return array $empty Empty array with object attributes as keys
     */
    public static function getEmpty()
    {
        $temp = new self;
        $empty = Schema::getColumnListing($temp->getTable());
        $empty = array_fill_keys($empty, '');

        return $empty;
    }
}
