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: README.md
+37-3Lines changed: 37 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ Features:
23
23
- Easily extend fields (customising a field type or adding a new one is as easy as creating a new view with a particular name)
24
24
- Easily overwrite functionality (customising how the create/update/delete/reorder process works is as easy as creating a new function with the proper name in your EntityCrudCrontroller)
25
25
26
-
**Subscribe to the [Mailchimp list](http://eepurl.com/bUEGjf) to be announced of any major features or breaking changes (once every 1-3 months).**
26
+
**Subscribe to the [Mailchimp list](http://eepurl.com/bUEGjf) to be announced of any major features or breaking changes (once every 1-3 months).**
27
27
28
28

5) If you haven't already, go through [steps 3-5 from the Backpack\Base installation](https://github.com/Laravel-Backpack/Base#install) (it provides the general views for the admin panel - layout, menu, notification bubbles, etc).
61
61
62
-
6)[Optional] You can now the file manager to the menu, in resources/views/vendor/backpack/base/inc/sidebar.blade.php or menu.blade.php:
62
+
6)[Optional] You can now the file manager to the menu, in `resources/views/vendor/backpack/base/inc/sidebar.blade.php` or `menu.blade.php`:
Check out the documentation at https://laravelbackpack.com
69
+
Check out the documentation at https://laravelbackpack.com
70
70
71
71
72
72
In short:
@@ -79,6 +79,40 @@ In short:
79
79
80
80
4.**(optional)** Define your validation rules in a Request files.
81
81
82
+
83
+
## **(Optional)** Enable Revisions
84
+
85
+
CRUD supports tracking and restoring Model change Revisions with the help of [VentureCraft/revisionable](https://github.com/VentureCraft/revisionable).
86
+
87
+
To enable revisions on your Model do the following:
2. Add the `\Venturecraft\Revisionable\RevisionableTrait` Trait to your Model. E.g:
95
+
```php
96
+
namespace MyApp\Models;
97
+
98
+
class Article extends Eloquent {
99
+
use \Backpack\CRUD\CrudTrait, \Venturecraft\Revisionable\RevisionableTrait;
100
+
101
+
// If you are using another bootable trait the be sure to override the boot method in your model
102
+
public static function boot()
103
+
{
104
+
parent::boot();
105
+
}
106
+
}
107
+
```
108
+
109
+
3. Enable access to Revisions in your CrudController with:
110
+
```php
111
+
$this->crud->allowAccess('revisions');
112
+
```
113
+
114
+
Head on over to the [VentureCraft/revisionable](https://github.com/VentureCraft/revisionable) GitHub repo to see the full documentation and extra configuration options.
$instance = newstatic(); // create an instance of the model to be able to get the table name
19
-
$type = DB::select(DB::raw('SHOW COLUMNS FROM '.$instance->getTable().' WHERE Field = "'.$field_name.'"'))[0]->Type;
20
+
$type = DB::select(DB::raw('SHOW COLUMNS FROM '.Config::get('database.connections.'.env('DB_CONNECTION').'.prefix').$instance->getTable().' WHERE Field = "'.$field_name.'"'))[0]->Type;
20
21
preg_match('/^enum\((.*)\)$/', $type, $matches);
21
22
$enum = [];
22
23
foreach (explode(',', $matches[1]) as$value) {
@@ -29,7 +30,7 @@ public static function getPossibleEnumValues($field_name)
$instance = newstatic(); // create an instance of the model to be able to get the table name
32
-
$answer = DB::select(DB::raw("SELECT IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".$instance->getTable()."' AND COLUMN_NAME='".$column_name."' AND table_schema='".env('DB_DATABASE')."'"))[0];
33
+
$answer = DB::select(DB::raw("SELECT IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".Config::get('database.connections.'.env('DB_CONNECTION').'.prefix').$instance->getTable()."' AND COLUMN_NAME='".$column_name."' AND table_schema='".env('DB_DATABASE')."'"))[0];
0 commit comments