<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class RelationExterior extends Model
{
    const CREATED_AT = null;
    const UPDATED_AT = null;
    
    protected $fillable = ['company_id', 'article_id', 'item_id'];
    //
    public static function getDataByArticleId($cid, $aid) 
    {
        $res = [];
        $result = RelationExterior::select('item_id')->where('company_id', '=', $cid)->where('article_id', '=', $aid)->get();
        foreach($result as $row) {
            $res[] = $row->item_id;
        }
        return $res;
    }
}
