@@ -14,10 +14,11 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | // create a event to happen on deleting |
| 16 | 16 | static::deleting(function($table) { |
| 17 | - if (class_exists('Cartalyst\Sentinel\Laravel\Facades\Sentinel')) |
|
| 18 | - $table->deleted_by = Sentinel::getUser()->id; |
|
| 19 | - else |
|
| 20 | - $table->deleted_by = Auth::user()->id; |
|
| 17 | + if (class_exists('Cartalyst\Sentinel\Laravel\Facades\Sentinel')) { |
|
| 18 | + $table->deleted_by = Sentinel::getUser()->id; |
|
| 19 | + } else { |
|
| 20 | + $table->deleted_by = Auth::user()->id; |
|
| 21 | + } |
|
| 21 | 22 | }); |
| 22 | 23 | |
| 23 | 24 | // create a event to happen on saving |
@@ -27,15 +28,16 @@ discard block |
||
| 27 | 28 | { |
| 28 | 29 | $table->modified_by = Sentinel::getUser()->id; |
| 29 | 30 | |
| 30 | - if (Sentinel::check() && ($table->created_by == null || !($table->created_by > 0))) |
|
| 31 | - $table->created_by = Sentinel::getUser()->id; |
|
| 32 | - } |
|
| 33 | - else |
|
| 31 | + if (Sentinel::check() && ($table->created_by == null || !($table->created_by > 0))) { |
|
| 32 | + $table->created_by = Sentinel::getUser()->id; |
|
| 33 | + } |
|
| 34 | + } else |
|
| 34 | 35 | { |
| 35 | 36 | $table->modified_by = Auth::user()->id; |
| 36 | 37 | |
| 37 | - if (!Auth::guest() && ($table->created_by == null || !($table->created_by > 0))) |
|
| 38 | - $table->created_by = Auth::user()->id; |
|
| 38 | + if (!Auth::guest() && ($table->created_by == null || !($table->created_by > 0))) { |
|
| 39 | + $table->created_by = Auth::user()->id; |
|
| 40 | + } |
|
| 39 | 41 | } |
| 40 | 42 | |
| 41 | 43 | }); |