<?php

/*
 * @component UserPoints
 * @copyright Copyright (C) Martin Brampton
 * @license : GNU/GPL
 * @Website : https://remository.com
 */
namespace BlackSheepResearch\Component\UserPoints\Administrator;

// no direct access
defined('_JEXEC') or die('Restricted access');

use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use BlackSheepResearch\Component\UserPoints\Site\UserPoints;

class Model extends BaseDatabaseModel {
    
    protected $app = null;
    
    public function __construct () {
        parent::__construct();
        $this->app = Factory::getApplication();
    }
    
    protected function redirect ($url, $message='', $type = 'info') {
        $this->app->enqueueMessage($message, $type);
        $this->app->redirect($url);
    }
    
    protected function triggerEvent ($eventName, $args) {
        return UserPoints::triggerEvent($eventName, $args);
    }
    
}
