baka / blameable
Set audit behavior for your module
Installs: 6 347
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 1
Open Issues: 1
Requires
- php: >=7.2
- ext-phalcon: >=3.0.0
- baka/auth: ^0.2
- phalcon/incubator: >=3.0
Requires (Dev)
- codeception/codeception: ^2.4
- codeception/verify: *
- fzaninotto/faker: ^1.9@dev
- odan/phinx-migrations-generator: dev-master
- phalcon/incubator: ~3.3
- vlucas/phpdotenv: ^2.0
README
Table of Contents
Blameable
use Baka\Blameable\BlameableTrait; class Leads extends Phalcon\Mvc\Model { use BlameableTrait; /** * Initialize */ public function initialize() { $this->keepSnapshots(true); $this->addBehavior(new \Baka\Blameable\Blameable()); } }
CREATE TABLE `audits` ( `id` bigint(20) UNSIGNED NOT NULL, `entity_id` int(10) UNSIGNED NOT NULL, `model_name` varchar(64) NOT NULL, `users_id` int(10) UNSIGNED NOT NULL, `ip` varchar(15) NOT NULL, `type` char(1) NOT NULL, `created_at` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- -- -- Table structure for table `audits_details` -- CREATE TABLE `audits_details` ( `id` bigint(20) UNSIGNED NOT NULL, `audits_id` bigint(20) UNSIGNED NOT NULL, `field_name` varchar(32) NOT NULL, `old_value` text, `old_value_text` text, `new_value` text, `new_value_text` text ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Indexes for dumped tables -- -- -- Indexes for table `audits` -- ALTER TABLE `audits` ADD PRIMARY KEY (`id`), ADD KEY `idx1` (`entity_id`), ADD KEY `idx2` (`model_name`), ADD KEY `idx3` (`users_id`), ADD KEY `idx4` (`type`), ADD KEY `idx5` (`model_name`,`type`), ADD KEY `idx6` (`entity_id`,`model_name`,`type`); -- -- Indexes for table `audits_details` -- ALTER TABLE `audits_details` ADD PRIMARY KEY (`id`), ADD KEY `idx1` (`audits_id`), ADD KEY `field_name` (`field_name`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `audits` -- ALTER TABLE `audits` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; -- -- AUTO_INCREMENT for table `audits_details` -- ALTER TABLE `audits_details` MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; COMMIT;