How to change the table name for the revision table by default it is 'revisions';
But I want it to something like page_revisions
cause there are many tables with different prefixes. So, I just need how to change the name via config in the model?

- 1,553
- 3
- 17
- 36
3 Answers
just specify a variable named $table in your revision model.
protected $table = 'page_revisions';

- 794
- 10
- 20
The table name is not configurable by the package.
If you want to do this, you will need to:
- Fork the package
- Update your composer.json to look at your forked package,
- Update the
$table
property in theVenturecraft\Revisionable\Revision
model in your fork to use thepage_revisions
table, and - Update the migration in your fork to create the
page_revisions
table.
However, once you fork the package, you will now be responsible for keeping it up to date with the original package (if you care about any updates).

- 59,488
- 15
- 143
- 145
I don't think forking is the right way. There's a way without forking, probably what Gokigooooks meant, but there are a few more steps necessary.
Make sure you've published the configuration (php artisan vendor:publish --provider="Venturecraft\Revisionable\RevisionableServiceProvider"
).
Next, create a modal Revision
in your app folder with the following content:
<?php
namespace App;
class Revision extends \Venturecraft\Revisionable\Revision
{
public $table = 'page_revisions';
}
Next, open the config file (config/revisionable.php
) and change the model class:
<?php
return [
'model' => App\Revision::class,
];
That way you only override the revision class and don't have to manage your own fork.

- 4,307
- 2
- 10
- 13