| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Give\Donations\ListTable\Columns; |
| 6 |
|
| 7 |
use Give\Donations\Models\Donation; |
| 8 |
use Give\Framework\ListTable\ModelColumn; |
| 9 |
use Give\Framework\Support\Facades\DateTime\Temporal; |
| 10 |
|
| 11 |
/** |
| 12 |
* @since 2.24.0 |
| 13 |
* |
| 14 |
* @extends ModelColumn<Donation> |
| 15 |
*/ |
| 16 |
class CreatedAtColumn extends ModelColumn |
| 17 |
{ |
| 18 |
|
| 19 |
protected $sortColumn = 'createdAt'; |
| 20 |
|
| 21 |
/** |
| 22 |
* @since 2.24.0 |
| 23 |
* |
| 24 |
* @inheritDoc |
| 25 |
*/ |
| 26 |
public static function getId(): string |
| 27 |
{ |
| 28 |
return 'createdAt'; |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* @since 4.10.0 Updated column label |
| 33 |
* @since 2.24.0 |
| 34 |
* |
| 35 |
* @inheritDoc |
| 36 |
*/ |
| 37 |
public function getLabel(): string |
| 38 |
{ |
| 39 |
return __('Date', 'give'); |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* @since 4.13.0 updated the date format |
| 44 |
* |
| 45 |
* @since 2.24.0 |
| 46 |
* |
| 47 |
* @inheritDoc |
| 48 |
* |
| 49 |
* @param Donation $model |
| 50 |
*/ |
| 51 |
public function getCellValue($model): string |
| 52 |
{ |
| 53 |
return Temporal::getFormattedDateTimeUsingTimeZoneAndFormatSettings($model->createdAt); |
| 54 |
} |
| 55 |
} |
| 56 |
|