Marketing.php 621 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Casts\Attribute;
  4. use Illuminate\Database\Eloquent\Model;
  5. /**
  6. * 营销
  7. */
  8. class Marketing extends Model
  9. {
  10. protected $table = 'marketing';
  11. protected $guarded = [];
  12. protected function statusLabel(): Attribute
  13. {
  14. return Attribute::make(
  15. get: fn () => match ($this->status) {
  16. -1 => trans('common.failed'),
  17. 0 => trans('common.status.pending_dispatch'),
  18. 1 => trans('common.success'),
  19. default => trans('common.status.unknown'),
  20. },
  21. );
  22. }
  23. }