Skip to content

Commit 6d23b44

Browse files
committed
Revisions operation was turned into the Revise add-on
1 parent fba77ad commit 6d23b44

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

4.1/crud-operation-revisions.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# Revisions
1+
# Revise
22

33
---
44

55
<a name="about"></a>
66
## About
77

8-
Revisions allows your admins to store, see and undo changes to entries on an Eloquent model.
8+
Revise allows your admins to store, see and undo changes to entries on an Eloquent model.
99

1010
The operation provides you with a simple interface to work with [venturecraft/revisionable](https://github.com/VentureCraft/revisionable#implementation), which is a great pacakge that stores all changes in a separate table. It can work as an audit trail, a backup system and an accountability system for the admins.
1111

12-
When enabled, ```Revisions``` will show another button in the table view, between _Edit_ and _Delete_. On click, that button opens another page which will allow an admin to see all changes and who made them:
12+
When enabled, ```Revise``` will show another button in the table view, between _Edit_ and _Delete_. On click, that button opens another page which will allow an admin to see all changes and who made them:
1313

1414

1515
![CRUD Revision Operation](https://backpackforlaravel.com/uploads/docs-4-0/operations/revisions.png)
@@ -20,16 +20,22 @@ When enabled, ```Revisions``` will show another button in the table view, betwee
2020

2121
In order to enable this operation for a CrudController, you need to:
2222

23-
1. Create the revisions table:
23+
**Step 1.** Install [the package](https://github.com/laravel-backpack/revise-operation) that provides this operation. This will also install venturecraft/revisionable if it's not already installed in your project.
24+
25+
```bash
26+
composer require backpack/revise-operation
27+
```
28+
29+
**Step 2.** Create the revisions table:
2430

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

29-
2. Use [venturecraft/revisionable](https://github.com/VentureCraft/revisionable#implementation) 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.
35+
**Step 3.** Use [venturecraft/revisionable](https://github.com/VentureCraft/revisionable#implementation)'s trait 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.
3036

3137
```php
32-
namespace MyApp\Models;
38+
namespace App\Models;
3339

3440
class Article extends Eloquent {
3541
use \Backpack\CRUD\CrudTrait, \Venturecraft\Revisionable\RevisionableTrait;
@@ -48,7 +54,7 @@ class Article extends Eloquent {
4854
}
4955
```
5056

51-
3. In your CrudController, add the Revisions trait:
57+
**Step 4.** In your CrudController, use the operation trait:
5258

5359
```php
5460
<?php
@@ -57,9 +63,9 @@ namespace App\Http\Controllers\Admin;
5763

5864
use Backpack\CRUD\app\Http\Controllers\CrudController;
5965

60-
class CategoryCrudController extends CrudController
66+
class ArticleCrudController extends CrudController
6167
{
62-
use \Backpack\CRUD\app\Http\Controllers\Operations\RevisionsOperation;
68+
use \Backpack\ReviseOperation\ReviseOperation;
6369
```
6470

65-
For complex usage, head on over to [VentureCraft/revisionable](https://github.com/VentureCraft/revisionable) to see the full documentation and extra configuration options.
71+
For complex usage, head over to [VentureCraft/revisionable](https://github.com/VentureCraft/revisionable) to see the full documentation and configuration options.

4.1/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
- [Additional Operations](/docs/{{version}}/crud-operations)
3737
+ [Clone](/docs/{{version}}/crud-operation-clone)
3838
+ [Reorder](/docs/{{version}}/crud-operation-reorder)
39-
+ [Revisions](/docs/{{version}}/crud-operation-revisions)
39+
+ [Revise](/docs/{{version}}/crud-operation-revisions)
4040
+ [Fetch](/docs/{{version}}/crud-operation-fetch)
4141
+ [InlineCreate](/docs/{{version}}/crud-operation-inline-create)
4242
- [How To](/docs/{{version}}/crud-how-to)

0 commit comments

Comments
 (0)