add formats

This commit is contained in:
Билай Станислав 2024-08-08 16:31:26 +03:00
parent 7dbff619f5
commit d0f136e484
5 changed files with 36 additions and 0 deletions

View File

@ -6,6 +6,7 @@
"email": "Email", "email": "Email",
"created_at": "Дата создания", "created_at": "Дата создания",
"description": "Описание 1", "description": "Описание 1",
"description2": "Описание 2",
"status": "Статус" "status": "Статус"
}, },
"actions": ["view"], "actions": ["view"],

View File

@ -12,6 +12,9 @@ $table->columns([
"created_at" => [ "created_at" => [
"format" => "date:Y-m-d", "format" => "date:Y-m-d",
], ],
'description2' => [
"format" => "html:",
],
'status' => function ($cell) { 'status' => function ($cell) {
return getStatusLabel()[$cell]; return getStatusLabel()[$cell];
}, },

View File

@ -3,6 +3,8 @@
namespace Itguild\Tables; namespace Itguild\Tables;
use Itguild\Tables\formats\DateFormat; use Itguild\Tables\formats\DateFormat;
use Itguild\Tables\formats\HtmlFormat;
use Itguild\Tables\formats\PhoneNumberFormat;
use Itguild\Tables\formats\TextFormat; use Itguild\Tables\formats\TextFormat;
class FormatMapper class FormatMapper
@ -13,6 +15,8 @@ class FormatMapper
return [ return [
'text' => TextFormat::class, 'text' => TextFormat::class,
'date' => DateFormat::class, 'date' => DateFormat::class,
'html' => HtmlFormat::class,
'phoneNumber' => PhoneNumberFormat::class,
]; ];
} }

View File

@ -0,0 +1,14 @@
<?php
namespace Itguild\Tables\formats;
use Itguild\Tables\formats\BaseFormat;
class HtmlFormat extends BaseFormat
{
static function fetch(?string $data, string $options = "")
{
return;
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace Itguild\Tables\formats;
use Itguild\Tables\formats\BaseFormat;
class PhoneNumberFormat extends BaseFormat
{
static function fetch(?string $data, string $options = "")
{
return;
}
}