您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Blamable.php 480B

1234567891011121314151617181920
  1. <?php
  2. namespace App\Traits;
  3. use Illuminate\Support\Facades\Auth;
  4. trait Blamable
  5. {
  6. public static function bootBlamable(): void
  7. {
  8. static::creating(static function ($model) {
  9. $model->created_by = Auth::check() ? Auth::id() : null;
  10. $model->updated_by = Auth::check() ? Auth::id() : null;
  11. });
  12. static::updating(static function ($model) {
  13. $model->updated_by = Auth::check() ? Auth::id() : null;
  14. });
  15. }
  16. }