AdminOperationLog.php 687 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: shenyang
  5. * Date: 2017/9/14
  6. * Time: 上午10:18
  7. */
  8. namespace app\common\models;
  9. use app\Jobs\AdminOperationLogQueueJob;
  10. class AdminOperationLog extends BaseModel
  11. {
  12. protected $table = 'yz_admin_operation_log';
  13. public $timestamps = true;
  14. protected $guarded = ['id'];
  15. protected $casts = [
  16. 'after' => 'json',
  17. 'before' => 'json',
  18. ];
  19. public function save(array $options = [])
  20. {
  21. $this->ip = request()->ip();
  22. $this->admin_uid = \YunShop::app()->uid;
  23. $this->uid = \YunShop::app()->getMemberId();
  24. (new AdminOperationLogQueueJob($this->getAttributes()))->handle();
  25. }
  26. }