OutTransaction.php 591B

1234567891011121314151617181920212223242526272829
  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 OutTransaction extends Model
  8. {
  9. use HasFactory;
  10. protected $fillable = [
  11. 'plat_number',
  12. 'price',
  13. 'entry_transaction_id',
  14. 'type_vehicle_id',
  15. 'user_id',
  16. ];
  17. protected function createdAt(): Attribute
  18. {
  19. return Attribute::make(
  20. get:fn($value) => Carbon::parse($value)->translatedFormat('l d/m/Y')
  21. );
  22. }
  23. }