Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
708045664c | |||
d3cda0bd8f | |||
3bb6ae8b07 | |||
850b0b315a |
@ -2,7 +2,7 @@
|
|||||||
"name": "itguild/eloquent-table",
|
"name": "itguild/eloquent-table",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"require": {
|
"require": {
|
||||||
"itguild/tables": "^0.1.9"
|
"itguild/tables": "^1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"illuminate/database": "^12.0@dev",
|
"illuminate/database": "^12.0@dev",
|
||||||
|
119
composer.lock
generated
119
composer.lock
generated
@ -4,15 +4,15 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "ee2becfe4c626d6528700c6b89b77875",
|
"content-hash": "815b5be2be1ac86399ea520c5bdbe788",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "itguild/tables",
|
"name": "itguild/tables",
|
||||||
"version": "0.1.14",
|
"version": "1.0.5",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.itguild.info/ItGuild/tables",
|
"url": "https://git.itguild.info/ItGuild/tables",
|
||||||
"reference": "9e7c83b680301497d15223a320e665279f9c2555"
|
"reference": "ad18d94489c20599ac1080a8b4f7f3199f206fdf"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"autoload": {
|
"autoload": {
|
||||||
@ -30,7 +30,7 @@
|
|||||||
"email": "apuc06@mail.ru"
|
"email": "apuc06@mail.ru"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-08-07T11:31:07+00:00"
|
"time": "2024-08-29T10:13:51+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
@ -528,12 +528,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/illuminate/database.git",
|
"url": "https://github.com/illuminate/database.git",
|
||||||
"reference": "97a835e279896de51754c2316f9812884b294e2c"
|
"reference": "e8a4eba8573bb907b0336033851cad7adbca4394"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/illuminate/database/zipball/97a835e279896de51754c2316f9812884b294e2c",
|
"url": "https://api.github.com/repos/illuminate/database/zipball/e8a4eba8573bb907b0336033851cad7adbca4394",
|
||||||
"reference": "97a835e279896de51754c2316f9812884b294e2c",
|
"reference": "e8a4eba8573bb907b0336033851cad7adbca4394",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -589,7 +589,7 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2024-08-01T21:50:50+00:00"
|
"time": "2024-08-16T18:32:47+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "illuminate/filesystem",
|
"name": "illuminate/filesystem",
|
||||||
@ -787,12 +787,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/briannesbitt/Carbon.git",
|
"url": "https://github.com/briannesbitt/Carbon.git",
|
||||||
"reference": "cb4374784c87d0a0294e8513a52eb63c0aff3139"
|
"reference": "bbd3eef89af8ba66a3aa7952b5439168fbcc529f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/cb4374784c87d0a0294e8513a52eb63c0aff3139",
|
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/bbd3eef89af8ba66a3aa7952b5439168fbcc529f",
|
||||||
"reference": "cb4374784c87d0a0294e8513a52eb63c0aff3139",
|
"reference": "bbd3eef89af8ba66a3aa7952b5439168fbcc529f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -886,7 +886,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-07-16T22:29:20+00:00"
|
"time": "2024-08-19T06:22:39+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpoption/phpoption",
|
"name": "phpoption/phpoption",
|
||||||
@ -1192,18 +1192,86 @@
|
|||||||
],
|
],
|
||||||
"time": "2024-08-06T10:13:52+00:00"
|
"time": "2024-08-06T10:13:52+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/deprecation-contracts",
|
||||||
|
"version": "dev-main",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/deprecation-contracts.git",
|
||||||
|
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
|
||||||
|
"reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=8.1"
|
||||||
|
},
|
||||||
|
"default-branch": true,
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-main": "3.5-dev"
|
||||||
|
},
|
||||||
|
"thanks": {
|
||||||
|
"name": "symfony/contracts",
|
||||||
|
"url": "https://github.com/symfony/contracts"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"function.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A generic function and convention to trigger deprecation notices",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"support": {
|
||||||
|
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://symfony.com/sponsor",
|
||||||
|
"type": "custom"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://github.com/fabpot",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-04-18T09:32:20+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/finder",
|
"name": "symfony/finder",
|
||||||
"version": "7.2.x-dev",
|
"version": "7.2.x-dev",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/finder.git",
|
"url": "https://github.com/symfony/finder.git",
|
||||||
"reference": "9a54be47a3813ace04e40e0903b651f3a52d952d"
|
"reference": "0470b8dc10ca08d23aeaabbed5b961c928e4d89d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/finder/zipball/9a54be47a3813ace04e40e0903b651f3a52d952d",
|
"url": "https://api.github.com/repos/symfony/finder/zipball/0470b8dc10ca08d23aeaabbed5b961c928e4d89d",
|
||||||
"reference": "9a54be47a3813ace04e40e0903b651f3a52d952d",
|
"reference": "0470b8dc10ca08d23aeaabbed5b961c928e4d89d",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -1254,7 +1322,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-08-06T10:13:52+00:00"
|
"time": "2024-08-13T14:29:53+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/polyfill-ctype",
|
"name": "symfony/polyfill-ctype",
|
||||||
@ -1581,16 +1649,17 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/translation.git",
|
"url": "https://github.com/symfony/translation.git",
|
||||||
"reference": "a50ed69ace45368e096bc3981f456089253ed6cb"
|
"reference": "a1c4be3a5885b9785b131c5a30d93e611848cb1d"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/translation/zipball/a50ed69ace45368e096bc3981f456089253ed6cb",
|
"url": "https://api.github.com/repos/symfony/translation/zipball/a1c4be3a5885b9785b131c5a30d93e611848cb1d",
|
||||||
"reference": "a50ed69ace45368e096bc3981f456089253ed6cb",
|
"reference": "a1c4be3a5885b9785b131c5a30d93e611848cb1d",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=8.2",
|
"php": ">=8.2",
|
||||||
|
"symfony/deprecation-contracts": "^2.5|^3",
|
||||||
"symfony/polyfill-mbstring": "~1.0",
|
"symfony/polyfill-mbstring": "~1.0",
|
||||||
"symfony/translation-contracts": "^2.5|^3.0"
|
"symfony/translation-contracts": "^2.5|^3.0"
|
||||||
},
|
},
|
||||||
@ -1667,7 +1736,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-08-05T08:22:14+00:00"
|
"time": "2024-08-19T08:28:32+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/translation-contracts",
|
"name": "symfony/translation-contracts",
|
||||||
@ -1754,12 +1823,12 @@
|
|||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/twbs/bootstrap.git",
|
"url": "https://github.com/twbs/bootstrap.git",
|
||||||
"reference": "3083596e87146c1c5a61de7238cb69e1dab5ae8b"
|
"reference": "e3e00b5002139adb0d5dadd6002e15b7b6cd371f"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/twbs/bootstrap/zipball/3083596e87146c1c5a61de7238cb69e1dab5ae8b",
|
"url": "https://api.github.com/repos/twbs/bootstrap/zipball/e3e00b5002139adb0d5dadd6002e15b7b6cd371f",
|
||||||
"reference": "3083596e87146c1c5a61de7238cb69e1dab5ae8b",
|
"reference": "e3e00b5002139adb0d5dadd6002e15b7b6cd371f",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"replace": {
|
"replace": {
|
||||||
@ -1797,7 +1866,7 @@
|
|||||||
"issues": "https://github.com/twbs/bootstrap/issues",
|
"issues": "https://github.com/twbs/bootstrap/issues",
|
||||||
"source": "https://github.com/twbs/bootstrap/tree/main"
|
"source": "https://github.com/twbs/bootstrap/tree/main"
|
||||||
},
|
},
|
||||||
"time": "2024-08-07T10:11:06+00:00"
|
"time": "2024-08-27T12:36:45+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "vlucas/phpdotenv",
|
"name": "vlucas/phpdotenv",
|
||||||
@ -1971,5 +2040,5 @@
|
|||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": [],
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.6.0"
|
"plugin-api-version": "2.3.0"
|
||||||
}
|
}
|
||||||
|
21
index.php
21
index.php
@ -44,16 +44,21 @@ try {
|
|||||||
'currentPage' => 1,
|
'currentPage' => 1,
|
||||||
'perPage' => 3,
|
'perPage' => 3,
|
||||||
'params' => ["class" => "table table-bordered", "border" => "2"],
|
'params' => ["class" => "table table-bordered", "border" => "2"],
|
||||||
'baseUrl' => "/admin/user"
|
'baseUrl' => "/admin/user",
|
||||||
|
'filters' => ["email"]
|
||||||
]));
|
]));
|
||||||
$table->columns([
|
$table->columns([
|
||||||
'created_at' => function ($data) {
|
'username' => [
|
||||||
if (!$data){
|
'filter' => [
|
||||||
return null;
|
'class' => \Itguild\Tables\Filter\InputTextFilter::class
|
||||||
}
|
]
|
||||||
|
],
|
||||||
return (new DateTimeImmutable($data))->format("d-m-Y");
|
'created_at' => [
|
||||||
},
|
'format' => 'date:d-m-Y',
|
||||||
|
'filter' => [
|
||||||
|
'class' => \Itguild\Tables\Filter\InputDateFilter::class
|
||||||
|
]
|
||||||
|
],
|
||||||
'updated_at' => function ($data) {
|
'updated_at' => function ($data) {
|
||||||
if (!$data){
|
if (!$data){
|
||||||
return null;
|
return null;
|
||||||
|
@ -50,7 +50,7 @@ class EloquentDataProvider
|
|||||||
$this->meta['actions'] = $options['actions'] ?? [];
|
$this->meta['actions'] = $options['actions'] ?? [];
|
||||||
$this->filters = $options['filters'] ?? [];
|
$this->filters = $options['filters'] ?? [];
|
||||||
$this->createQuery();
|
$this->createQuery();
|
||||||
$this->jsonStr = (new JSONCreator($this->meta, $this->filters, $this->getCollection()->toArray()))->getJson();
|
$this->jsonStr = (new JSONCreator($this->meta, $this->getCollection()->toArray(), $this->filters,))->getJson();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createQuery(): void
|
public function createQuery(): void
|
||||||
|
@ -7,7 +7,7 @@ class JSONCreator
|
|||||||
{
|
{
|
||||||
protected array $informationArray = [];
|
protected array $informationArray = [];
|
||||||
|
|
||||||
public function __construct(array $meta, array $filters, array $data)
|
public function __construct(array $meta, array $data, array $filters = [])
|
||||||
{
|
{
|
||||||
$params = empty($meta['params']) ? ["class" => "table table-bordered", "border" => "1"] : $meta['params'];
|
$params = empty($meta['params']) ? ["class" => "table table-bordered", "border" => "1"] : $meta['params'];
|
||||||
if ($meta) {
|
if ($meta) {
|
||||||
@ -27,7 +27,6 @@ class JSONCreator
|
|||||||
{
|
{
|
||||||
if ($infArr)
|
if ($infArr)
|
||||||
return json_encode($infArr, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
|
return json_encode($infArr, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user