2017 © Pedro Peláez
 

cakephp-plugin cakephp-blame

CakePHP plugin for blaming a user (from AuthComponent) for save action on models.

image

hmic/cakephp-blame

CakePHP plugin for blaming a user (from AuthComponent) for save action on models.

  • Wednesday, January 14, 2015
  • by hmic
  • Repository
  • 1 Watchers
  • 0 Stars
  • 182 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

CakePHP 3.0 plugin to update e.g. created_by and modified_by fields. Idea taken from and originates of ceeram/blame, (*1)

Installation

Add the following lines to your application's composer.json:, (*2)

    "require": {
        "hmic/cakephp-blame": "dev-master"
    }

followed by the command:, (*3)

composer update, (*4)

Or run the following command directly without changing your composer.json:, (*5)

composer require hmic/cakephp-blame:dev-master, (*6)

OR: Create a plugins/Blame dir under your app's dir and checkout this repo and make sure ['autoload' => true] is set when loading the plugin like shown below., (*7)

Usage

In your app's config/bootstrap.php add: Plugin::load('Blame', ['autoload' => true]);, (*8)

Configuration

Add the following line to your AppController:, (*9)

    use \Blame\Controller\BlameTrait;

Attach the behavior in the models you like to use. Please note that these need to have the following 2 fields in the database table for it to work: created_by int(11) NULL and modified_by int(11) NULL, (*10)

    public function initialize(array $config) {
        $this->addBehavior('Blame.Blame');
    }

Routing

Has been fixed in the core in the meantime - just works right now!, (*11)

This is work in progress, but you can have routing working, for use with baked views, (works only for the default configuration for now) by adding this to your app's `config/routes.php` directly defore the `$routes->fallbacks();` and commenting that out, like this: ``` $routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'Blame.BlameRoute']); $routes->connect('/:controller/:action/*', [], ['routeClass' => 'Blame.BlameRoute']); // $routes->fallbacks(); ```

Bake

If you want to bake your stuff you need to bake the model first, then add the behavior as shown above and afterwards bake the controller and views. It will take care of the associations automatically. For the routing of the baked views to work for the assocations too, see above., (*12)

The Versions

14/01 2015

dev-master

9999999-dev http://github.com/hmic/blame

CakePHP plugin for blaming a user (from AuthComponent) for save action on models.

  Sources   Download

MIT

The Requires

 

The Development Requires

29/09 2014

0.3

0.3.0.0

CakePHP plugin to update created_by and modified_by fields

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Ceeram

19/09 2014

0.2

0.2.0.0

CakePHP plugin to update created_by and modified_by fields

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Ceeram

16/09 2014

0.1

0.1.0.0

CakePHP plugin to update created_by and modified_by fields

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Ceeram