<?php

namespace App\Danoral\Elementos;

use App\Danoral\ModelBase;
use Illuminate\Support\Facades\DB;

class ListItem extends ModelBase
{
    protected $table = 'config.list_items';
    protected $primaryKey = 'idListItem';
    public $incrementing = false;
    public $timestamps = false;

    public $columns;

    public function loadColumns(){
        $columns = DB::table('config.list_items_columns')
            ->where('idListItem', $this->idListItem)
            ->orderBy('position', 'asc')
            ->get();

        if($columns) {
            $this->columns = $columns;
        }
    }
}
