| @@ 6-36 (lines=31) @@ | ||
| 3 | use Illuminate\Database\Eloquent\Model; |
|
| 4 | use Illuminate\Database\Eloquent\SoftDeletes; |
|
| 5 | ||
| 6 | class DummyModel extends Model |
|
| 7 | { |
|
| 8 | use SoftDeletes; |
|
| 9 | protected $table = 'DummyTableName'; |
|
| 10 | protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 11 | protected $hidden = ['deleted_at']; |
|
| 12 | protected $guarded = ['id']; |
|
| 13 | protected $fillable = []; // Add attributes here |
|
| 14 | public $searchable = []; // Add earchable attributes here |
|
| 15 | ||
| 16 | public function getCreatedAtAttribute($value) |
|
| 17 | { |
|
| 18 | return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
| 19 | } |
|
| 20 | ||
| 21 | public function getUpdatedAtAttribute($value) |
|
| 22 | { |
|
| 23 | return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function getDeletedAtAttribute($value) |
|
| 27 | { |
|
| 28 | return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
| 29 | } |
|
| 30 | ||
| 31 | public static function boot() |
|
| 32 | { |
|
| 33 | parent::boot(); |
|
| 34 | DummyModel::observe(\App::make('App\Modules\DummyModule\ModelObservers\DummyObserver')); |
|
| 35 | } |
|
| 36 | } |
|
| 37 | ||
| @@ 6-36 (lines=31) @@ | ||
| 3 | use Illuminate\Database\Eloquent\Model; |
|
| 4 | use Illuminate\Database\Eloquent\SoftDeletes; |
|
| 5 | ||
| 6 | class Role extends Model |
|
| 7 | { |
|
| 8 | use SoftDeletes; |
|
| 9 | protected $table = 'roles'; |
|
| 10 | protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 11 | protected $hidden = ['deleted_at']; |
|
| 12 | protected $guarded = ['id']; |
|
| 13 | protected $fillable = []; // Add attributes here |
|
| 14 | public $searchable = []; // Add earchable attributes here |
|
| 15 | ||
| 16 | public function getCreatedAtAttribute($value) |
|
| 17 | { |
|
| 18 | return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
| 19 | } |
|
| 20 | ||
| 21 | public function getUpdatedAtAttribute($value) |
|
| 22 | { |
|
| 23 | return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
| 24 | } |
|
| 25 | ||
| 26 | public function getDeletedAtAttribute($value) |
|
| 27 | { |
|
| 28 | return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
| 29 | } |
|
| 30 | ||
| 31 | public static function boot() |
|
| 32 | { |
|
| 33 | parent::boot(); |
|
| 34 | Role::observe(\App::make('App\Modules\Roles\ModelObservers\RoleObserver')); |
|
| 35 | } |
|
| 36 | } |
|
| 37 | ||