ModLog.php 762 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class ModLog extends Model
  5. {
  6. protected $visible = ['id'];
  7. protected $fillable = ['*'];
  8. public function admin()
  9. {
  10. return $this->belongsTo(User::class, 'user_id');
  11. }
  12. public function actionToText()
  13. {
  14. $msg = 'Unknown action';
  15. switch ($this->action) {
  16. case 'admin.user.mail':
  17. $msg = "Sent Message";
  18. break;
  19. case 'admin.user.action.cw.warn':
  20. $msg = "Sent CW reminder";
  21. break;
  22. case 'admin.user.edit':
  23. $msg = "Changed Profile";
  24. break;
  25. case 'admin.user.moderate':
  26. $msg = "Moderation";
  27. break;
  28. case 'admin.user.delete':
  29. $msg = "Deleted Account";
  30. break;
  31. default:
  32. $msg = 'Unknown action';
  33. break;
  34. }
  35. return $msg;
  36. }
  37. }