<?php
/**
 * Created by PhpStorm.
 * User: edz
 * Date: 2019-06-10
 * Time: 17:53
 */

namespace App\Repositories;


use App\Models\Behavior;
use Illuminate\Support\Facades\Log;

class BehaviorRepositories
{
    public function __construct()
    {
    }

    /**
     * 获取行为绑定规则
     * @param $info
     * @return array
     */
    public function getBehavior($identify)
    {
        $info = Behavior::where([['is_open', '=', 1], ['behavior_identification', '=', $identify]])->first();
        Log::debug('behavior:' . json_encode($info));
        if ($info) {
            return $info;
        }
        return [];
    }

    /**
     * 获取所有行为
     */
    public function getAllBehavior()
    {
        return Behavior::pluck('virus_behavior_id', 'behavior_identification');
    }


}