<?php

class institutions extends datatable
{
    protected static $data = array(
        "ins_name" => [
            "required" => true
        ],
        "parent" => []
    );

    protected static $table = array(
        "name" => "institutions",
        "primary" => "ins_id"
    );

    public static function all()
    {
        $data =  self::query("SELECT * from " . static::$table['name']);

        if ($data['success']) {
            return $data['data'];
        } else {
            return false;
        }
    }

    public static function parents()
    {
        $data =  self::query("SELECT * from " . static::$table['name'] . " where parent is null");

        if ($data['success']) {
            return $data['data'];
        } else {
            return false;
        }
    }
}
