Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/laravel-backpack/revise-operation

An admin interface for venturecraft/revisionable - audit log for your Eloquent entries.
https://github.com/laravel-backpack/revise-operation

Last synced: about 23 hours ago
JSON representation

An admin interface for venturecraft/revisionable - audit log for your Eloquent entries.

Awesome Lists containing this project

README

        

# ReviseOperation for Backpack for Laravel

[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE.md)
[![Build Status][ico-travis]][link-travis]
[![Total Downloads][ico-downloads]][link-downloads]
[![StyleCI][ico-styleci]][link-styleci]

Adds an interface for [```venturecraft/revisionable```](https://github.com/VentureCraft/revisionable) to your Backpack CRUDs, so that the admin can:
- see the changes that have been made to an entry;
- undo changes;

[```venturecraft/revisionable```](https://github.com/VentureCraft/revisionable) allows you to store, see and undo changes to entries on an Eloquent model. This package just provides an admin interface for it, in the form of a Backpack operation, that you can use on the CrudControllers of entities that have the Revisionable trait.

When used, this operation will show another button for each entry in the table view. On click, that button opens another page, which will allow an admin to see all changes and who made them:

![https://backpackforlaravel.com/uploads/docs-4-0/operations/revisions.png](https://backpackforlaravel.com/uploads/docs-4-0/operations/revisions.png)

## Installation

**Step 1.** Require the package:

``` bash
composer require backpack/revise-operation
```

This will automatically install ```venturecraft/revisionable``` too, if it's not already installed.

**Step 2.** Create the Revisions table:

``` bash
cp vendor/venturecraft/revisionable/src/migrations/2013_04_09_062329_create_revisions_table.php database/migrations/ && php artisan migrate
```

**Step 3.** Use RevisionableTrait on your model, and an ```identifiableName()``` method that returns an attribute on the model that the admin can use to distiguish between entries (ex: name, title, etc). If you are using another bootable trait be sure to override the boot method in your model.

```php
namespace MyApp\Models;

class Article extends Eloquent {
use \Backpack\CRUD\CrudTrait, \Venturecraft\Revisionable\RevisionableTrait;

public function identifiableName()
{
return $this->name;
}

// If you are using another bootable trait
// be sure to override the boot method in your model
public static function boot()
{
parent::boot();
}
}
```

**Step 4.** In your CrudController, use the operation trait:
```php