Completed
Push — 2.0 ( c38687...fea887 )
by Marcel
07:47
created
src/Mpociot/Versionable/Version.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,10 +64,10 @@
 block discarded – undo
64 64
     public function revert()
65 65
     {
66 66
         $model = $this->getModel();
67
-        unset( $model->{$model->getCreatedAtColumn()} );
68
-        unset( $model->{$model->getUpdatedAtColumn()} );
67
+        unset($model->{$model->getCreatedAtColumn()} );
68
+        unset($model->{$model->getUpdatedAtColumn()} );
69 69
         if (method_exists($model, 'getDeletedAtColumn')) {
70
-            unset( $model->{$model->getDeletedAtColumn()} );
70
+            unset($model->{$model->getDeletedAtColumn()} );
71 71
         }
72 72
         $model->save();
73 73
         return $model;
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 namespace Mpociot\Versionable;
3 3
 
4 4
 use Illuminate\Support\Facades\Config;
5
-use Illuminate\Database\Eloquent\Model as Eloquent;
6 5
 use Illuminate\Database\Eloquent\Model;
7 6
 
8 7
 /**
Please login to merge, or discard this patch.
src/Mpociot/Versionable/VersionableTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public static function bootVersionableTrait()
73 73
     {
74
-        static::saving(function ($model) {
74
+        static::saving(function($model) {
75 75
             $model->versionablePreSave();
76 76
         });
77 77
 
78
-        static::saved(function ($model) {
78
+        static::saved(function($model) {
79 79
             $model->versionablePostSave();
80 80
         });
81 81
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
          * We'll save new versions on updating and first creation
148 148
          */
149 149
         if (
150
-            ( $this->versioningEnabled === true && $this->updating && $this->isValidForVersioning() ) ||
151
-            ( $this->versioningEnabled === true && !$this->updating )
150
+            ($this->versioningEnabled === true && $this->updating && $this->isValidForVersioning()) ||
151
+            ($this->versioningEnabled === true && !$this->updating)
152 152
         ) {
153 153
             // Save a new version
154 154
             $version                   = new Version();
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             $version->user_id          = $this->getAuthUserId();
158 158
             $version->model_data       = serialize($this->getAttributes());
159 159
 
160
-            if (!empty( $this->reason )) {
160
+            if (!empty($this->reason)) {
161 161
                 $version->reason = $this->reason;
162 162
             }
163 163
 
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
      */
173 173
     private function isValidForVersioning()
174 174
     {
175
-        $dontVersionFields = isset( $this->dontVersionFields ) ? $this->dontVersionFields : [];
176
-        $removeableKeys    = array_merge($dontVersionFields, [$this->getUpdatedAtColumn()]);
175
+        $dontVersionFields = isset($this->dontVersionFields) ? $this->dontVersionFields : [ ];
176
+        $removeableKeys    = array_merge($dontVersionFields, [ $this->getUpdatedAtColumn() ]);
177 177
 
178 178
         if (method_exists($this, 'getDeletedAtColumn')) {
179
-            $removeableKeys[] = $this->getDeletedAtColumn();
179
+            $removeableKeys[ ] = $this->getDeletedAtColumn();
180 180
         }
181 181
 
182
-        return ( count(array_diff_key($this->versionableDirtyData, array_flip($removeableKeys))) > 0 );
182
+        return (count(array_diff_key($this->versionableDirtyData, array_flip($removeableKeys))) > 0);
183 183
     }
184 184
 
185 185
     /**
Please login to merge, or discard this patch.
src/migrations/2015_03_13_213643_add_reason.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -5,30 +5,30 @@
 block discarded – undo
5 5
 
6 6
 class AddReason extends Migration {
7 7
 
8
-	/**
9
-	 * Run the migrations.
10
-	 *
11
-	 * @return void
12
-	 */
13
-	public function up()
14
-	{
15
-		Schema::table('versions', function(Blueprint $table)
16
-		{
8
+    /**
9
+     * Run the migrations.
10
+     *
11
+     * @return void
12
+     */
13
+    public function up()
14
+    {
15
+        Schema::table('versions', function(Blueprint $table)
16
+        {
17 17
             $table->string('reason', 100)->nullable()->after('model_data');
18
-		});
19
-	}
18
+        });
19
+    }
20 20
 
21
-	/**
22
-	 * Reverse the migrations.
23
-	 *
24
-	 * @return void
25
-	 */
26
-	public function down()
27
-	{
28
-		Schema::table('versions', function(Blueprint $table)
29
-		{
21
+    /**
22
+     * Reverse the migrations.
23
+     *
24
+     * @return void
25
+     */
26
+    public function down()
27
+    {
28
+        Schema::table('versions', function(Blueprint $table)
29
+        {
30 30
             $table->dropColumn('reason');
31
-		});
32
-	}
31
+        });
32
+    }
33 33
 
34 34
 }
Please login to merge, or discard this patch.
src/migrations/2014_09_27_212641_create_versions_table.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -5,32 +5,32 @@
 block discarded – undo
5 5
 
6 6
 class CreateVersionsTable extends Migration {
7 7
 
8
-	/**
9
-	 * Run the migrations.
10
-	 *
11
-	 * @return void
12
-	 */
13
-	public function up()
14
-	{
15
-		Schema::create('versions', function(Blueprint $table)
16
-		{
17
-			$table->increments('version_id');
18
-			$table->integer('versionable_id');
8
+    /**
9
+     * Run the migrations.
10
+     *
11
+     * @return void
12
+     */
13
+    public function up()
14
+    {
15
+        Schema::create('versions', function(Blueprint $table)
16
+        {
17
+            $table->increments('version_id');
18
+            $table->integer('versionable_id');
19 19
             $table->text('versionable_type');
20
-			$table->integer('user_id')->nullable();
21
-			$table->binary('model_data');
22
-			$table->timestamps();
23
-		});
24
-	}
20
+            $table->integer('user_id')->nullable();
21
+            $table->binary('model_data');
22
+            $table->timestamps();
23
+        });
24
+    }
25 25
 
26
-	/**
27
-	 * Reverse the migrations.
28
-	 *
29
-	 * @return void
30
-	 */
31
-	public function down()
32
-	{
33
-		Schema::drop('versions');
34
-	}
26
+    /**
27
+     * Reverse the migrations.
28
+     *
29
+     * @return void
30
+     */
31
+    public function down()
32
+    {
33
+        Schema::drop('versions');
34
+    }
35 35
 
36 36
 }
Please login to merge, or discard this patch.