fix modules and FileUpload class

This commit is contained in:
Билай Станислав 2024-09-10 15:45:12 +03:00
parent fa8fb69f19
commit 89b6f1ac8c
10 changed files with 139 additions and 112 deletions

View File

@ -3,8 +3,8 @@
"description": "Implementation of Database Queries with illuminate and Eloquent", "description": "Implementation of Database Queries with illuminate and Eloquent",
"type": "project", "type": "project",
"require": { "require": {
"illuminate/database": "^11.21", "illuminate/database": "11.21",
"illuminate/filesystem": "^11.21", "illuminate/filesystem": "11.21",
"craft-group/phroute": "^2.1", "craft-group/phroute": "^2.1",
"vlucas/phpdotenv": "^5.6", "vlucas/phpdotenv": "^5.6",
"twig/twig": "^3.0", "twig/twig": "^3.0",

134
composer.lock generated
View File

@ -4,7 +4,7 @@
"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": "d3db480dffe7843fbe0d0ecf114b0a86", "content-hash": "45dd495df00abd36d94dc7ca02dce256",
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",
@ -337,16 +337,16 @@
}, },
{ {
"name": "illuminate/collections", "name": "illuminate/collections",
"version": "v11.21.0", "version": "v11.22.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/collections.git", "url": "https://github.com/illuminate/collections.git",
"reference": "d373c9f382f38dc5e612dbe1cd196b154cd1063c" "reference": "66d2c9bdf5641599735d402c1c504b54734a9cca"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/collections/zipball/d373c9f382f38dc5e612dbe1cd196b154cd1063c", "url": "https://api.github.com/repos/illuminate/collections/zipball/66d2c9bdf5641599735d402c1c504b54734a9cca",
"reference": "d373c9f382f38dc5e612dbe1cd196b154cd1063c", "reference": "66d2c9bdf5641599735d402c1c504b54734a9cca",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -388,11 +388,11 @@
"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-19T02:05:39+00:00" "time": "2024-08-23T18:49:36+00:00"
}, },
{ {
"name": "illuminate/conditionable", "name": "illuminate/conditionable",
"version": "v11.21.0", "version": "v11.22.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/conditionable.git", "url": "https://github.com/illuminate/conditionable.git",
@ -438,16 +438,16 @@
}, },
{ {
"name": "illuminate/container", "name": "illuminate/container",
"version": "v11.21.0", "version": "v11.22.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/container.git", "url": "https://github.com/illuminate/container.git",
"reference": "4e353ac5dc1c61eb28e1d3721741989dd692df15" "reference": "85e3396fde3139eae3f37128222c9a7746ca4bbb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/container/zipball/4e353ac5dc1c61eb28e1d3721741989dd692df15", "url": "https://api.github.com/repos/illuminate/container/zipball/85e3396fde3139eae3f37128222c9a7746ca4bbb",
"reference": "4e353ac5dc1c61eb28e1d3721741989dd692df15", "reference": "85e3396fde3139eae3f37128222c9a7746ca4bbb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -485,20 +485,20 @@
"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-17T21:07:31+00:00" "time": "2024-08-21T16:01:30+00:00"
}, },
{ {
"name": "illuminate/contracts", "name": "illuminate/contracts",
"version": "v11.21.0", "version": "v11.22.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/contracts.git", "url": "https://github.com/illuminate/contracts.git",
"reference": "34ead9385e0eab7e947807d77da66faf9bdf95ff" "reference": "af9b459f195d57f279ec30a45446ddaeb3337bcb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/contracts/zipball/34ead9385e0eab7e947807d77da66faf9bdf95ff", "url": "https://api.github.com/repos/illuminate/contracts/zipball/af9b459f195d57f279ec30a45446ddaeb3337bcb",
"reference": "34ead9385e0eab7e947807d77da66faf9bdf95ff", "reference": "af9b459f195d57f279ec30a45446ddaeb3337bcb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -533,7 +533,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-01T19:08:33+00:00" "time": "2024-08-21T16:02:16+00:00"
}, },
{ {
"name": "illuminate/database", "name": "illuminate/database",
@ -672,7 +672,7 @@
}, },
{ {
"name": "illuminate/macroable", "name": "illuminate/macroable",
"version": "v11.21.0", "version": "v11.22.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/macroable.git", "url": "https://github.com/illuminate/macroable.git",
@ -718,16 +718,16 @@
}, },
{ {
"name": "illuminate/support", "name": "illuminate/support",
"version": "v11.21.0", "version": "v11.22.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/support.git", "url": "https://github.com/illuminate/support.git",
"reference": "82e493e7b9bb94d1b065260170e3ecbfd3670126" "reference": "51efc0516526413b4be641a1731d15d4394de2ff"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/support/zipball/82e493e7b9bb94d1b065260170e3ecbfd3670126", "url": "https://api.github.com/repos/illuminate/support/zipball/51efc0516526413b4be641a1731d15d4394de2ff",
"reference": "82e493e7b9bb94d1b065260170e3ecbfd3670126", "reference": "51efc0516526413b4be641a1731d15d4394de2ff",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -788,7 +788,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-20T14:50:34+00:00" "time": "2024-09-03T13:21:20+00:00"
}, },
{ {
"name": "itguild/eloquent-table", "name": "itguild/eloquent-table",
@ -827,11 +827,11 @@
}, },
{ {
"name": "itguild/forms", "name": "itguild/forms",
"version": "0.1.3", "version": "0.1.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.itguild.info/ItGuild/forms_bundle.git", "url": "https://git.itguild.info/ItGuild/forms_bundle.git",
"reference": "62e1e8f3382391fd00adb5b4421015c2faa6e19b" "reference": "ddb17cc47360910b3875b88e10e14f91fcd875be"
}, },
"require": { "require": {
"itguild/php-cg-select-v2": "^0.1.0", "itguild/php-cg-select-v2": "^0.1.0",
@ -855,7 +855,7 @@
"email": "apuc06@mail.ru" "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", "name": "itguild/php-cg-select-v2",
@ -1636,20 +1636,20 @@
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
"version": "v1.30.0", "version": "v1.31.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git", "url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "0424dff1c58f028c451efff2045f5d92410bd540" "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
"reference": "0424dff1c58f028c451efff2045f5d92410bd540", "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.2"
}, },
"provide": { "provide": {
"ext-ctype": "*" "ext-ctype": "*"
@ -1695,7 +1695,7 @@
"portable" "portable"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0"
}, },
"funding": [ "funding": [
{ {
@ -1711,24 +1711,24 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T15:07:36+00:00" "time": "2024-09-09T11:45:10+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.30.0", "version": "v1.31.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341",
"reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.2"
}, },
"provide": { "provide": {
"ext-mbstring": "*" "ext-mbstring": "*"
@ -1775,7 +1775,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0"
}, },
"funding": [ "funding": [
{ {
@ -1791,24 +1791,24 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-06-19T12:30:46+00:00" "time": "2024-09-09T11:45:10+00:00"
}, },
{ {
"name": "symfony/polyfill-php80", "name": "symfony/polyfill-php80",
"version": "v1.30.0", "version": "v1.31.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php80.git", "url": "https://github.com/symfony/polyfill-php80.git",
"reference": "77fa7995ac1b21ab60769b7323d600a991a90433" "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"reference": "77fa7995ac1b21ab60769b7323d600a991a90433", "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.2"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -1855,7 +1855,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0"
}, },
"funding": [ "funding": [
{ {
@ -1871,24 +1871,24 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T15:07:36+00:00" "time": "2024-09-09T11:45:10+00:00"
}, },
{ {
"name": "symfony/polyfill-php81", "name": "symfony/polyfill-php81",
"version": "v1.30.0", "version": "v1.31.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php81.git", "url": "https://github.com/symfony/polyfill-php81.git",
"reference": "3fb075789fb91f9ad9af537c4012d523085bd5af" "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/3fb075789fb91f9ad9af537c4012d523085bd5af", "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
"reference": "3fb075789fb91f9ad9af537c4012d523085bd5af", "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.2"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -1931,7 +1931,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-php81/tree/v1.30.0" "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0"
}, },
"funding": [ "funding": [
{ {
@ -1947,24 +1947,24 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-06-19T12:30:46+00:00" "time": "2024-09-09T11:45:10+00:00"
}, },
{ {
"name": "symfony/polyfill-php83", "name": "symfony/polyfill-php83",
"version": "v1.30.0", "version": "v1.31.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php83.git", "url": "https://github.com/symfony/polyfill-php83.git",
"reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9" "reference": "2fb86d65e2d424369ad2905e83b236a8805ba491"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9", "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/2fb86d65e2d424369ad2905e83b236a8805ba491",
"reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9", "reference": "2fb86d65e2d424369ad2905e83b236a8805ba491",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.2"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -2007,7 +2007,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-php83/tree/v1.30.0" "source": "https://github.com/symfony/polyfill-php83/tree/v1.31.0"
}, },
"funding": [ "funding": [
{ {
@ -2023,7 +2023,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-06-19T12:35:24+00:00" "time": "2024-09-09T11:45:10+00:00"
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",
@ -2249,16 +2249,16 @@
}, },
{ {
"name": "twig/twig", "name": "twig/twig",
"version": "v3.12.0", "version": "v3.14.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/twigphp/Twig.git", "url": "https://github.com/twigphp/Twig.git",
"reference": "4d19472d4ac1838e0b1f0e029ce1fa4040eb34ea" "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/4d19472d4ac1838e0b1f0e029ce1fa4040eb34ea", "url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
"reference": "4d19472d4ac1838e0b1f0e029ce1fa4040eb34ea", "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2312,7 +2312,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/twigphp/Twig/issues", "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": [ "funding": [
{ {
@ -2324,7 +2324,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-08-29T09:51:12+00:00" "time": "2024-09-09T17:55:12+00:00"
}, },
{ {
"name": "vlucas/phpdotenv", "name": "vlucas/phpdotenv",

View File

@ -17,10 +17,10 @@ class FileUpload
protected string $fileType; protected string $fileType;
protected array $fileNameCmps; protected array $fileNameCmps;
protected string $fileExtension; protected string $fileExtension;
// public string $newFileName;
public array $allowedFileExtensions; 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->fileTmpPath = $file['tmp_name'];
$this->fileName = $file['name']; $this->fileName = $file['name'];
@ -29,43 +29,65 @@ class FileUpload
$this->fileNameCmps = explode('.', $this->fileName); $this->fileNameCmps = explode('.', $this->fileName);
$this->fileExtension = strtolower(end($this->fileNameCmps)); $this->fileExtension = strtolower(end($this->fileNameCmps));
$this->allowedFileExtensions = $extensions; $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 public function upload($uploadDir = "/resources/upload/"): bool
{ {
$newFileName = md5(time() . $this->fileName) . '.' . $this->fileExtension; if ($this->hashing) {
if (in_array($this->fileExtension, $this->allowedFileExtensions)) { $newFileName = md5(time() . $this->fileName) . '.' . $this->fileExtension;
$this->uploadDir = $uploadDir . mb_substr($newFileName, 0, 2) . '/' . mb_substr($newFileName, 2, 2) . '/'; if (in_array($this->fileExtension, $this->allowedFileExtensions)) {
mkdir(ROOT_DIR . $this->uploadDir, 0777, true); $this->uploadDir = $uploadDir . mb_substr($newFileName, 0, 2) . '/' . mb_substr($newFileName, 2, 2) . '/';
$uploadFileDir = ROOT_DIR . $this->uploadDir; mkdir(ROOT_DIR . $this->uploadDir, 0777, true);
$this->destPath = $uploadFileDir . $newFileName; $uploadFileDir = ROOT_DIR . $this->uploadDir;
$this->uploadFile = $this->uploadDir . $newFileName; $this->destPath = $uploadFileDir . $newFileName;
move_uploaded_file($this->fileTmpPath, $this->destPath); $this->uploadFile = $this->uploadDir . $newFileName;
move_uploaded_file($this->fileTmpPath, $this->destPath);
return true; return true;
} else {
return false;
}
} else { } else {
return false; 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 public function getFullUploadedPath(): string
{ {
return $this->destPath; 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 public function getUploadDir(): string
{ {
return $this->uploadDir; return $this->uploadDir;

View File

@ -3,14 +3,13 @@
namespace kernel\modules\menu\controllers; namespace kernel\modules\menu\controllers;
use app\helpers\Debug; use app\helpers\Debug;
use app\models\forms\CreateMenuForm;
use kernel\FileUpload;
use kernel\modules\menu\service\MenuService;
use Exception; use Exception;
use JetBrains\PhpStorm\NoReturn; use JetBrains\PhpStorm\NoReturn;
use kernel\AdminController; use kernel\AdminController;
use kernel\Controller; use kernel\FileUpload;
use kernel\models\Menu; use kernel\models\Menu;
use kernel\modules\menu\models\forms\CreateMenuForm;
use kernel\modules\menu\service\MenuService;
use Twig\Error\LoaderError; use Twig\Error\LoaderError;
use Twig\Error\RuntimeError; use Twig\Error\RuntimeError;
use Twig\Error\SyntaxError; use Twig\Error\SyntaxError;
@ -101,9 +100,10 @@ class MenuController extends AdminController
$menuForm = new CreateMenuForm(); $menuForm = new CreateMenuForm();
$menuForm->load($_REQUEST); $menuForm->load($_REQUEST);
// Debug::dd($_REQUEST);
if (isset($_FILES['icon_file']) && $_FILES['icon_file']['error'] === UPLOAD_ERR_OK) { 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(); $file->upload();
$menuForm->setItem('icon_file', $file->getUploadFile()); $menuForm->setItem('icon_file', $file->getUploadFile());
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace app\models\forms; namespace kernel\modules\menu\models\forms;
use kernel\FormModel; use kernel\FormModel;

View File

@ -23,6 +23,13 @@ $form->field(class: \itguild\forms\inputs\File::class, name: "icon_file", params
->setLabel("Путь к иконке") ->setLabel("Путь к иконке")
->render(); ->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: [ $form->field(class: \itguild\forms\inputs\TextInput::class, name: "icon_font", params: [
'class' => "form-control", 'class' => "form-control",
'value' => $model->icon_font ?? '' 'value' => $model->icon_font ?? ''

View File

@ -3,13 +3,12 @@
namespace kernel\modules\post\controllers; 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 Exception;
use JetBrains\PhpStorm\NoReturn; 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 class PostController extends AdminController
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
namespace app\models\forms; namespace kernel\modules\post\models\forms;
use kernel\FormModel; use kernel\FormModel;

View File

@ -2,13 +2,12 @@
namespace kernel\modules\user\controllers; 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 Exception;
use JetBrains\PhpStorm\NoReturn; 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\LoaderError;
use Twig\Error\RuntimeError; use Twig\Error\RuntimeError;
use Twig\Error\SyntaxError; use Twig\Error\SyntaxError;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace app\models\forms; namespace kernel\modules\user\models\forms;
use kernel\FormModel; use kernel\FormModel;