fix modules and FileUpload class
This commit is contained in:
parent
fa8fb69f19
commit
89b6f1ac8c
@ -3,8 +3,8 @@
|
||||
"description": "Implementation of Database Queries with illuminate and Eloquent",
|
||||
"type": "project",
|
||||
"require": {
|
||||
"illuminate/database": "^11.21",
|
||||
"illuminate/filesystem": "^11.21",
|
||||
"illuminate/database": "11.21",
|
||||
"illuminate/filesystem": "11.21",
|
||||
"craft-group/phroute": "^2.1",
|
||||
"vlucas/phpdotenv": "^5.6",
|
||||
"twig/twig": "^3.0",
|
||||
|
134
composer.lock
generated
134
composer.lock
generated
@ -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": "d3db480dffe7843fbe0d0ecf114b0a86",
|
||||
"content-hash": "45dd495df00abd36d94dc7ca02dce256",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
@ -337,16 +337,16 @@
|
||||
},
|
||||
{
|
||||
"name": "illuminate/collections",
|
||||
"version": "v11.21.0",
|
||||
"version": "v11.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/collections.git",
|
||||
"reference": "d373c9f382f38dc5e612dbe1cd196b154cd1063c"
|
||||
"reference": "66d2c9bdf5641599735d402c1c504b54734a9cca"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/collections/zipball/d373c9f382f38dc5e612dbe1cd196b154cd1063c",
|
||||
"reference": "d373c9f382f38dc5e612dbe1cd196b154cd1063c",
|
||||
"url": "https://api.github.com/repos/illuminate/collections/zipball/66d2c9bdf5641599735d402c1c504b54734a9cca",
|
||||
"reference": "66d2c9bdf5641599735d402c1c504b54734a9cca",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -388,11 +388,11 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2024-08-19T02:05:39+00:00"
|
||||
"time": "2024-08-23T18:49:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/conditionable",
|
||||
"version": "v11.21.0",
|
||||
"version": "v11.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/conditionable.git",
|
||||
@ -438,16 +438,16 @@
|
||||
},
|
||||
{
|
||||
"name": "illuminate/container",
|
||||
"version": "v11.21.0",
|
||||
"version": "v11.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/container.git",
|
||||
"reference": "4e353ac5dc1c61eb28e1d3721741989dd692df15"
|
||||
"reference": "85e3396fde3139eae3f37128222c9a7746ca4bbb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/container/zipball/4e353ac5dc1c61eb28e1d3721741989dd692df15",
|
||||
"reference": "4e353ac5dc1c61eb28e1d3721741989dd692df15",
|
||||
"url": "https://api.github.com/repos/illuminate/container/zipball/85e3396fde3139eae3f37128222c9a7746ca4bbb",
|
||||
"reference": "85e3396fde3139eae3f37128222c9a7746ca4bbb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -485,20 +485,20 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2024-08-17T21:07:31+00:00"
|
||||
"time": "2024-08-21T16:01:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/contracts",
|
||||
"version": "v11.21.0",
|
||||
"version": "v11.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/contracts.git",
|
||||
"reference": "34ead9385e0eab7e947807d77da66faf9bdf95ff"
|
||||
"reference": "af9b459f195d57f279ec30a45446ddaeb3337bcb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/contracts/zipball/34ead9385e0eab7e947807d77da66faf9bdf95ff",
|
||||
"reference": "34ead9385e0eab7e947807d77da66faf9bdf95ff",
|
||||
"url": "https://api.github.com/repos/illuminate/contracts/zipball/af9b459f195d57f279ec30a45446ddaeb3337bcb",
|
||||
"reference": "af9b459f195d57f279ec30a45446ddaeb3337bcb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -533,7 +533,7 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2024-08-01T19:08:33+00:00"
|
||||
"time": "2024-08-21T16:02:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "illuminate/database",
|
||||
@ -672,7 +672,7 @@
|
||||
},
|
||||
{
|
||||
"name": "illuminate/macroable",
|
||||
"version": "v11.21.0",
|
||||
"version": "v11.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/macroable.git",
|
||||
@ -718,16 +718,16 @@
|
||||
},
|
||||
{
|
||||
"name": "illuminate/support",
|
||||
"version": "v11.21.0",
|
||||
"version": "v11.22.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/illuminate/support.git",
|
||||
"reference": "82e493e7b9bb94d1b065260170e3ecbfd3670126"
|
||||
"reference": "51efc0516526413b4be641a1731d15d4394de2ff"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/illuminate/support/zipball/82e493e7b9bb94d1b065260170e3ecbfd3670126",
|
||||
"reference": "82e493e7b9bb94d1b065260170e3ecbfd3670126",
|
||||
"url": "https://api.github.com/repos/illuminate/support/zipball/51efc0516526413b4be641a1731d15d4394de2ff",
|
||||
"reference": "51efc0516526413b4be641a1731d15d4394de2ff",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -788,7 +788,7 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2024-08-20T14:50:34+00:00"
|
||||
"time": "2024-09-03T13:21:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "itguild/eloquent-table",
|
||||
@ -827,11 +827,11 @@
|
||||
},
|
||||
{
|
||||
"name": "itguild/forms",
|
||||
"version": "0.1.3",
|
||||
"version": "0.1.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://git.itguild.info/ItGuild/forms_bundle.git",
|
||||
"reference": "62e1e8f3382391fd00adb5b4421015c2faa6e19b"
|
||||
"reference": "ddb17cc47360910b3875b88e10e14f91fcd875be"
|
||||
},
|
||||
"require": {
|
||||
"itguild/php-cg-select-v2": "^0.1.0",
|
||||
@ -855,7 +855,7 @@
|
||||
"email": "apuc06@mail.ru"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-03T09:45:20+00:00"
|
||||
"time": "2024-09-10T08:41:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "itguild/php-cg-select-v2",
|
||||
@ -1636,20 +1636,20 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
"version": "v1.30.0",
|
||||
"version": "v1.31.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-ctype.git",
|
||||
"reference": "0424dff1c58f028c451efff2045f5d92410bd540"
|
||||
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540",
|
||||
"reference": "0424dff1c58f028c451efff2045f5d92410bd540",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
|
||||
"reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"provide": {
|
||||
"ext-ctype": "*"
|
||||
@ -1695,7 +1695,7 @@
|
||||
"portable"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0"
|
||||
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -1711,24 +1711,24 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-05-31T15:07:36+00:00"
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.30.0",
|
||||
"version": "v1.31.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c"
|
||||
"reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c",
|
||||
"reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341",
|
||||
"reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"provide": {
|
||||
"ext-mbstring": "*"
|
||||
@ -1775,7 +1775,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0"
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -1791,24 +1791,24 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-06-19T12:30:46+00:00"
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php80",
|
||||
"version": "v1.30.0",
|
||||
"version": "v1.31.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php80.git",
|
||||
"reference": "77fa7995ac1b21ab60769b7323d600a991a90433"
|
||||
"reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433",
|
||||
"reference": "77fa7995ac1b21ab60769b7323d600a991a90433",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
|
||||
"reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@ -1855,7 +1855,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0"
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -1871,24 +1871,24 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-05-31T15:07:36+00:00"
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php81",
|
||||
"version": "v1.30.0",
|
||||
"version": "v1.31.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php81.git",
|
||||
"reference": "3fb075789fb91f9ad9af537c4012d523085bd5af"
|
||||
"reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/3fb075789fb91f9ad9af537c4012d523085bd5af",
|
||||
"reference": "3fb075789fb91f9ad9af537c4012d523085bd5af",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
|
||||
"reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@ -1931,7 +1931,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php81/tree/v1.30.0"
|
||||
"source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -1947,24 +1947,24 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-06-19T12:30:46+00:00"
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php83",
|
||||
"version": "v1.30.0",
|
||||
"version": "v1.31.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php83.git",
|
||||
"reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9"
|
||||
"reference": "2fb86d65e2d424369ad2905e83b236a8805ba491"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9",
|
||||
"reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/2fb86d65e2d424369ad2905e83b236a8805ba491",
|
||||
"reference": "2fb86d65e2d424369ad2905e83b236a8805ba491",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
@ -2007,7 +2007,7 @@
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php83/tree/v1.30.0"
|
||||
"source": "https://github.com/symfony/polyfill-php83/tree/v1.31.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -2023,7 +2023,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-06-19T12:35:24+00:00"
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
@ -2249,16 +2249,16 @@
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v3.12.0",
|
||||
"version": "v3.14.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/Twig.git",
|
||||
"reference": "4d19472d4ac1838e0b1f0e029ce1fa4040eb34ea"
|
||||
"reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/4d19472d4ac1838e0b1f0e029ce1fa4040eb34ea",
|
||||
"reference": "4d19472d4ac1838e0b1f0e029ce1fa4040eb34ea",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
|
||||
"reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2312,7 +2312,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/twigphp/Twig/issues",
|
||||
"source": "https://github.com/twigphp/Twig/tree/v3.12.0"
|
||||
"source": "https://github.com/twigphp/Twig/tree/v3.14.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -2324,7 +2324,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-08-29T09:51:12+00:00"
|
||||
"time": "2024-09-09T17:55:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "vlucas/phpdotenv",
|
||||
|
@ -17,10 +17,10 @@ class FileUpload
|
||||
protected string $fileType;
|
||||
protected array $fileNameCmps;
|
||||
protected string $fileExtension;
|
||||
// public string $newFileName;
|
||||
public array $allowedFileExtensions;
|
||||
protected bool $hashing = true;
|
||||
|
||||
public function __construct(array $file, array $extensions, $hashing = true)
|
||||
public function __construct(array $file, array $extensions, bool $hashing = true)
|
||||
{
|
||||
$this->fileTmpPath = $file['tmp_name'];
|
||||
$this->fileName = $file['name'];
|
||||
@ -29,23 +29,12 @@ class FileUpload
|
||||
$this->fileNameCmps = explode('.', $this->fileName);
|
||||
$this->fileExtension = strtolower(end($this->fileNameCmps));
|
||||
$this->allowedFileExtensions = $extensions;
|
||||
$this->hashing = $hashing;
|
||||
}
|
||||
|
||||
// public function setNewFileName(): void
|
||||
// {
|
||||
// $this->newFileName = md5(time() . $this->fileName) . '.' . $this->fileExtension;
|
||||
// }
|
||||
|
||||
// public function checkExtension(): bool
|
||||
// {
|
||||
// if (in_array($this->fileExtension, $this->allowedFileExtensions)) {
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
public function upload($uploadDir = "/resources/upload/"): bool
|
||||
{
|
||||
if ($this->hashing) {
|
||||
$newFileName = md5(time() . $this->fileName) . '.' . $this->fileExtension;
|
||||
if (in_array($this->fileExtension, $this->allowedFileExtensions)) {
|
||||
$this->uploadDir = $uploadDir . mb_substr($newFileName, 0, 2) . '/' . mb_substr($newFileName, 2, 2) . '/';
|
||||
@ -59,6 +48,24 @@ class FileUpload
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (in_array($this->fileExtension, $this->allowedFileExtensions)) {
|
||||
$this->uploadDir = $uploadDir;
|
||||
mkdir(ROOT_DIR . $this->uploadDir, 0777, true);
|
||||
$uploadFileDir = ROOT_DIR . $this->uploadDir;
|
||||
$this->destPath = $uploadFileDir . $this->fileName;
|
||||
$this->uploadFile = $this->uploadDir . $this->fileName;
|
||||
move_uploaded_file($this->fileTmpPath, $this->destPath);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function setAllowedFileExtensions(array $allowedFileExtensions): void
|
||||
{
|
||||
$this->allowedFileExtensions = $allowedFileExtensions;
|
||||
}
|
||||
|
||||
public function getFullUploadedPath(): string
|
||||
@ -66,6 +73,21 @@ class FileUpload
|
||||
return $this->destPath;
|
||||
}
|
||||
|
||||
public function setDestPath(string $destPath): void
|
||||
{
|
||||
$this->destPath = $destPath;
|
||||
}
|
||||
|
||||
public function setUploadDir(string $uploadDir): void
|
||||
{
|
||||
$this->uploadDir = $uploadDir;
|
||||
}
|
||||
|
||||
public function setUploadFile(string $uploadFile): void
|
||||
{
|
||||
$this->uploadFile = $uploadFile;
|
||||
}
|
||||
|
||||
public function getUploadDir(): string
|
||||
{
|
||||
return $this->uploadDir;
|
||||
|
@ -3,14 +3,13 @@
|
||||
namespace kernel\modules\menu\controllers;
|
||||
|
||||
use app\helpers\Debug;
|
||||
use app\models\forms\CreateMenuForm;
|
||||
use kernel\FileUpload;
|
||||
use kernel\modules\menu\service\MenuService;
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
use kernel\AdminController;
|
||||
use kernel\Controller;
|
||||
use kernel\FileUpload;
|
||||
use kernel\models\Menu;
|
||||
use kernel\modules\menu\models\forms\CreateMenuForm;
|
||||
use kernel\modules\menu\service\MenuService;
|
||||
use Twig\Error\LoaderError;
|
||||
use Twig\Error\RuntimeError;
|
||||
use Twig\Error\SyntaxError;
|
||||
@ -101,9 +100,10 @@ class MenuController extends AdminController
|
||||
|
||||
$menuForm = new CreateMenuForm();
|
||||
$menuForm->load($_REQUEST);
|
||||
// Debug::dd($_REQUEST);
|
||||
|
||||
if (isset($_FILES['icon_file']) && $_FILES['icon_file']['error'] === UPLOAD_ERR_OK) {
|
||||
$file = new FileUpload($_FILES['icon_file'], ['jpg', 'jpeg', 'png']);
|
||||
$file = new FileUpload($_FILES['icon_file'], ['jpg', 'jpeg', 'png'], $_REQUEST['hashing'] ?? true);
|
||||
$file->upload();
|
||||
$menuForm->setItem('icon_file', $file->getUploadFile());
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace app\models\forms;
|
||||
namespace kernel\modules\menu\models\forms;
|
||||
|
||||
use kernel\FormModel;
|
||||
|
@ -23,6 +23,13 @@ $form->field(class: \itguild\forms\inputs\File::class, name: "icon_file", params
|
||||
->setLabel("Путь к иконке")
|
||||
->render();
|
||||
|
||||
$form->field(\itguild\forms\inputs\Checkbox::class, "hashing", params:[
|
||||
'value' => false
|
||||
// 'class' => "form-control"
|
||||
])
|
||||
->setLabel('Не хешировать')
|
||||
->render();
|
||||
|
||||
$form->field(class: \itguild\forms\inputs\TextInput::class, name: "icon_font", params: [
|
||||
'class' => "form-control",
|
||||
'value' => $model->icon_font ?? ''
|
||||
|
@ -3,13 +3,12 @@
|
||||
namespace kernel\modules\post\controllers;
|
||||
|
||||
|
||||
use app\helpers\Debug;
|
||||
use app\models\forms\CreatePostForm;
|
||||
use kernel\AdminController;
|
||||
use kernel\modules\post\models\Post;
|
||||
use kernel\modules\post\service\PostService;
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
use kernel\AdminController;
|
||||
use kernel\modules\post\models\forms\CreatePostForm;
|
||||
use kernel\modules\post\models\Post;
|
||||
use kernel\modules\post\service\PostService;
|
||||
|
||||
class PostController extends AdminController
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace app\models\forms;
|
||||
namespace kernel\modules\post\models\forms;
|
||||
|
||||
use kernel\FormModel;
|
||||
|
@ -2,13 +2,12 @@
|
||||
namespace kernel\modules\user\controllers;
|
||||
|
||||
|
||||
use app\models\forms\CreateUserForm;
|
||||
use kernel\modules\user\models\User;
|
||||
use kernel\AdminController;
|
||||
use kernel\modules\user\service\UserService;
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
use kernel\Controller;
|
||||
use kernel\AdminController;
|
||||
use kernel\modules\user\models\forms\CreateUserForm;
|
||||
use kernel\modules\user\models\User;
|
||||
use kernel\modules\user\service\UserService;
|
||||
use Twig\Error\LoaderError;
|
||||
use Twig\Error\RuntimeError;
|
||||
use Twig\Error\SyntaxError;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace app\models\forms;
|
||||
namespace kernel\modules\user\models\forms;
|
||||
|
||||
use kernel\FormModel;
|
||||
|
Loading…
Reference in New Issue
Block a user