Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation VentureCraft/revisionable #255

Open
GraveStone opened this issue Nov 2, 2016 · 5 comments
Open

Installation VentureCraft/revisionable #255

GraveStone opened this issue Nov 2, 2016 · 5 comments

Comments

@GraveStone
Copy link

For laravel 5.2 is necessary install the Sentry by Cartalyst or Sentinel by Cartalyst to use the VentureCraft/revisionable?
I have install the and configure the VentureCraft/revisionable and don't work.

@naveensnayak
Copy link

I am also trying to get this to work on Laravel 5.3 - its a plain install
followed instructions to install package
created migrations
verified that I can update a table in by database
using DB::table(tableName)->where(condition)->update()
nothing gets stored in the revisions table

is there anything additional to be done ?
or do we need to explicitly call some methods to save the revisions ?

@thorerik
Copy link

@GraveStone I got it in a (mostly) vanilla Laravel 5.3 install, what are you doing and how is it failing?
Have you run the necessary migrations?
Have you added the trait to your model?

@naveensnayak you shouldn't use an instance of DB but update it via your models.

eg.

$user = User::find(1);
$user->username = "foo";
$user->save();

this should add a revision to your table.

@naveensnayak
Copy link

@thorerik - I debugged the code and figured that out - it would be nice to mention this in the documentation as there are many ways to update the table. We have a mix of old code that does not use models

@thorerik
Copy link

@naveensnayak I thought it was pretty obvious since you're adding it to your eloquent models that you should use the models to update the rows. If you think there's something to be desired in the docs you can probably open a PR, I'm sure VentureCraft is more than happy to accept.

@northkode
Copy link

northkode commented Feb 28, 2017

I have some code that is not updating my revisions table either..

here is the sample code

<?php

	namespace App\Models;
	use Illuminate\Database\Eloquent\Model;

	class Purchase extends Model {
		use \Venturecraft\Revisionable\RevisionableTrait;

		public static function boot() {
	          parent::boot();
	        }

		protected $table = 'purchases';
		protected $fillable = [ 'user_id','amt','purchase_options_id','points'];
		protected $appends = ['user','type','staff'];

		public function getTypeAttribute() {
	           return PurchaseOption::find($this->purchase_options_id);
	        }

		public function getStaffAttribute() {
	            return User::find($this->admin_id);
	        }

		public function getUserAttribute() {
	            return User::find($this->user_id);
	        }
	}

?>

no errors.. all updates work. But just nothing in the revisions table. All migrations have run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants