You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 4.1/crud-operation-revisions.md
+16-10Lines changed: 16 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,15 @@
1
-
# Revisions
1
+
# Revise
2
2
3
3
---
4
4
5
5
<aname="about"></a>
6
6
## About
7
7
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.
9
9
10
10
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.
11
11
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:
@@ -20,16 +20,22 @@ When enabled, ```Revisions``` will show another button in the table view, betwee
20
20
21
21
In order to enable this operation for a CrudController, you need to:
22
22
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.
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.
30
36
31
37
```php
32
-
namespace MyApp\Models;
38
+
namespace App\Models;
33
39
34
40
class Article extends Eloquent {
35
41
use \Backpack\CRUD\CrudTrait, \Venturecraft\Revisionable\RevisionableTrait;
@@ -48,7 +54,7 @@ class Article extends Eloquent {
48
54
}
49
55
```
50
56
51
-
3. In your CrudController, add the Revisions trait:
57
+
**Step 4.** In your CrudController, use the operation trait:
use Backpack\CRUD\app\Http\Controllers\CrudController;
59
65
60
-
class CategoryCrudController extends CrudController
66
+
class ArticleCrudController extends CrudController
61
67
{
62
-
use \Backpack\CRUD\app\Http\Controllers\Operations\RevisionsOperation;
68
+
use \Backpack\ReviseOperation\ReviseOperation;
63
69
```
64
70
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.
0 commit comments