From 138c5149c18f2247e013496d018640a8b600e39c Mon Sep 17 00:00:00 2001 From: Kavalar Date: Wed, 7 Aug 2024 12:23:49 +0300 Subject: [PATCH] date fix --- composer.json | 2 +- composer.lock | 37 ++++++++++++++++++------------------- index.php | 27 ++++++++++++++++++--------- 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/composer.json b/composer.json index c11e594..1f80605 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "itguild/eloquent_table", "type": "library", "require": { - "itguild/tables": "dev-master", + "itguild/tables": "^0.1.9", "illuminate/database": "^12.0@dev", "illuminate/filesystem": "^12.0@dev", "vlucas/phpdotenv": "^5.6@dev", diff --git a/composer.lock b/composer.lock index 6bdf45b..9f81f58 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "eaa0a8a1e17d91b06acca9b9681bfe00", + "content-hash": "23ab91e73c3a10e841f8f2b12f05e49d", "packages": [ { "name": "brick/math", @@ -755,13 +755,12 @@ }, { "name": "itguild/tables", - "version": "dev-master", + "version": "0.1.12", "source": { "type": "git", "url": "https://git.itguild.info/ItGuild/tables", - "reference": "647fe34d119c801579f1343a49abfbd0359532b8" + "reference": "1bd82eb40b28a4b8b4c3b1fbeeabb523326a8632" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -778,7 +777,7 @@ "email": "apuc06@mail.ru" } ], - "time": "2024-07-31T11:51:39+00:00" + "time": "2024-08-07T09:16:42+00:00" }, { "name": "nesbot/carbon", @@ -1123,12 +1122,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/clock.git", - "reference": "23cc3e95ff85bdfd28a532484110969536a8e503" + "reference": "738af07b16942450f71491c995d35996893c8d85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/clock/zipball/23cc3e95ff85bdfd28a532484110969536a8e503", - "reference": "23cc3e95ff85bdfd28a532484110969536a8e503", + "url": "https://api.github.com/repos/symfony/clock/zipball/738af07b16942450f71491c995d35996893c8d85", + "reference": "738af07b16942450f71491c995d35996893c8d85", "shasum": "" }, "require": { @@ -1189,7 +1188,7 @@ "type": "tidelift" } ], - "time": "2024-06-20T15:52:34+00:00" + "time": "2024-08-06T10:13:52+00:00" }, { "name": "symfony/finder", @@ -1197,12 +1196,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "0f7f413c4b46ff3312500439fb250cb63e89cf78" + "reference": "9a54be47a3813ace04e40e0903b651f3a52d952d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/0f7f413c4b46ff3312500439fb250cb63e89cf78", - "reference": "0f7f413c4b46ff3312500439fb250cb63e89cf78", + "url": "https://api.github.com/repos/symfony/finder/zipball/9a54be47a3813ace04e40e0903b651f3a52d952d", + "reference": "9a54be47a3813ace04e40e0903b651f3a52d952d", "shasum": "" }, "require": { @@ -1253,7 +1252,7 @@ "type": "tidelift" } ], - "time": "2024-07-25T06:25:26+00:00" + "time": "2024-08-06T10:13:52+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1753,12 +1752,12 @@ "source": { "type": "git", "url": "https://github.com/twbs/bootstrap.git", - "reference": "8c10ee828f56a353f035f832fad45bbb596cf7b9" + "reference": "4e954ea3322e0a2c6428159108c676428a05d748" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twbs/bootstrap/zipball/8c10ee828f56a353f035f832fad45bbb596cf7b9", - "reference": "8c10ee828f56a353f035f832fad45bbb596cf7b9", + "url": "https://api.github.com/repos/twbs/bootstrap/zipball/4e954ea3322e0a2c6428159108c676428a05d748", + "reference": "4e954ea3322e0a2c6428159108c676428a05d748", "shasum": "" }, "replace": { @@ -1796,7 +1795,7 @@ "issues": "https://github.com/twbs/bootstrap/issues", "source": "https://github.com/twbs/bootstrap/tree/main" }, - "time": "2024-08-05T07:01:59+00:00" + "time": "2024-08-07T04:51:04+00:00" }, { "name": "vlucas/phpdotenv", @@ -1962,10 +1961,10 @@ "aliases": [], "minimum-stability": "dev", "stability-flags": { - "itguild/tables": 20, "illuminate/database": 20, "illuminate/filesystem": 20, - "vlucas/phpdotenv": 20 + "vlucas/phpdotenv": 20, + "twbs/bootstrap": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/index.php b/index.php index 7fd6e4c..839f63c 100644 --- a/index.php +++ b/index.php @@ -46,19 +46,28 @@ try { 'params' => ["class" => "table table-bordered", "border" => "2"], 'baseUrl' => "/admin/user" ])); + $table->columns([ + 'created_at' => function ($data) { + if (!$data){ + return null; + } + + return (new DateTimeImmutable($data))->format("d-m-Y"); + } + ]); $table->addAction(EditActionColumn::class); $table->create(); $table->render(); } catch (Exception $e) { } -//try { -// $table = new ViewEloquentTable(new ViewJsonTableEloquentModel(User::find(1), [ -// 'params' => ["class" => "table table-bordered", "border" => "2"], -// 'baseUrl' => "/admin/user", -// ])); -// $table->create(); -// $table->render(); -//} catch (Exception $e) { -//} +try { + $table = new ViewEloquentTable(new ViewJsonTableEloquentModel(User::find(1), [ + 'params' => ["class" => "table table-bordered", "border" => "2"], + 'baseUrl' => "/admin/user", + ])); + $table->create(); + $table->render(); +} catch (Exception $e) { +}