<?php

class AppLog extends \Phalcon\Mvc\Model
{

    /**
     *
     * @var string
     */
    public $kode;

    /**
     *
     * @var string
     */
    public $type;

    /**
     *
     * @var string
     */
    public $message;

    /**
     *
     * @var string
     */
    public $created_at;

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->setSchema("jaga");
        $this->setSource("app_log");
    }

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'app_log';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return AppLog[]|AppLog|\Phalcon\Mvc\Model\ResultSetInterface
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return AppLog|\Phalcon\Mvc\Model\ResultInterface
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

    public static function createLog($kode, $type, $message) {
        $model = new AppLog();
        $model->kode = $kode;
        $model->type = $type;
        $model->message = $message;
        $model->save();
    }

}
