for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @copyright Copyright (c) Flipbox Digital Limited
* @license https://github.com/flipbox/spark/blob/master/LICENSE
* @link https://github.com/flipbox/spark
*/
namespace flipbox\spark\models\traits;
use Craft;
use flipbox\spark\helpers\ModelHelper;
* @author Flipbox Factory <[email protected]>
* @since 2.0.0
trait ModelWithId
{
* @var integer
public $id;
* @inheritdoc
protected function idRules()
return [
[
'id'
],
'number',
'integerOnly' => true
'safe',
'on' => [
ModelHelper::SCENARIO_DEFAULT
]
];
}
protected function idAttributeLabel()
'id' => Craft::t('app', 'Id')
public function getId()
return $this->id;