TypeVehicle.php 629B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Models;
  3. use Carbon\Carbon;
  4. use Illuminate\Database\Eloquent\Casts\Attribute;
  5. use Illuminate\Database\Eloquent\Factories\HasFactory;
  6. use Illuminate\Database\Eloquent\Model;
  7. class TypeVehicle extends Model
  8. {
  9. use HasFactory;
  10. protected $fillable = [
  11. 'type',
  12. ];
  13. protected function updatedAt(): Attribute
  14. {
  15. return Attribute::make(
  16. get:fn($value) => Carbon::parse($value)->translatedFormat('l d/m/Y')
  17. );
  18. }
  19. protected function type(): Attribute
  20. {
  21. return Attribute::make(
  22. set:fn($value) => ucwords($value)
  23. );
  24. }
  25. }