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 Phalcon\Di;
class UserCompanyApps extends \Baka\Auth\Models\UserCompanyApps
{
/**
*
* @var integer
*/
public $companies_id;
public $apps_id;
* @var string
public $stripe_id;
public $subscriptions_id;
public $created_at;
public $updated_at;
public $is_deleted;
* Initialize method for model.
public function initialize()
parent::initialize();
$this->belongsTo(
'companies_id',
'Gewaer\Models\Companies',
'id',
['alias' => 'company']
);
'apps_id',
'Gewaer\Models\Apps',
['alias' => 'app']
$this->setSource('user_company_apps');
}
* Returns table name mapped in the model.
* @return string
public function getSource() : string
return 'user_company_apps';
* Get the current company app
* @return void
public static function getCurrentApp(): UserCompanyApps
return self::findFirst([
'conditions' => 'companies_id = ?0 and apps_id = ?1',
'bind' => [Di::getDefault()->getUserData()->currentCompanyId(), Di::getDefault()->getApp()->getId()]
]);