for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Gewaer\Models;
use Gewaer\Traits\UsersAssociatedTrait;
use Gewaer\Traits\ModelSettingsTrait;
class Apps extends \Baka\Auth\Models\Apps
{
/**
*
* @var integer
*/
public $id;
* @var string
public $name;
public $description;
public $url;
public $default_apps_plan_id;
public $is_actived;
public $created_at;
public $updated_at;
public $is_deleted;
* Ecosystem default app
const GEWAER_DEFAULT_APP_ID = 0;
const GEWAER_DEFAULT_APP_NAME = 'Default';
* Users Associated Trait
use UsersAssociatedTrait;
Gewaer\Traits\UsersAssociatedTrait
$roles_id
Gewaer\Models\Apps
* Model Settings Trait
use ModelSettingsTrait;
* Initialize method for model.
public function initialize()
parent::initialize();
$this->setSource('apps');
$this->hasOne(
'default_apps_plan_id',
'Gewaer\Models\AppsPlans',
'id',
['alias' => 'plan']
);
$this->hasMany(
'apps_id',
['alias' => 'plans']
'Gewaer\Models\UserWebhooks',
['alias' => 'user-webhooks']
'Gewaer\Models\AppsSettings',
['alias' => 'settings']
}
* You can only get 2 variations or default in DB or the api app
* @param string $name
* @return Apps
public static function getACLApp(string $name): Apps
if (trim($name) == self::GEWAER_DEFAULT_APP_NAME) {
$app = self::findFirst(0);
} else {
$app = self::findFirst(\Phalcon\DI::getDefault()->getConfig()->app->id);
return $app;
* Is active?
* @return boolean
public function isActive(): bool
return (bool) $this->is_actived;
* Returns table name mapped in the model.
* @return string
public function getSource() : string
return 'apps';