REBELinBLUE\Deployer\Project::boot PHP Method

boot() public static method

Override the boot method to bind model event listeners.
public static boot ( )
    public static function boot()
    {
        parent::boot();
        // When  creating the model generate an SSH Key pair and a webhook hash
        static::saving(function (Project $model) {
            if (!array_key_exists('private_key', $model->attributes) || $model->private_key === '') {
                $model->generateSSHKey();
            }
            if (!array_key_exists('public_key', $model->attributes) || $model->public_key === '') {
                $model->regeneratePublicKey();
            }
            if (!array_key_exists('hash', $model->attributes)) {
                $model->generateHash();
            }
        });
    }