kernel update

This commit is contained in:
2024-12-18 12:46:57 +03:00
parent 653e0bc983
commit 4ff9fa9ad3
56 changed files with 1023 additions and 84 deletions

View File

@ -6,6 +6,7 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public string $migration;
/**
* Run the migrations.
*/

View File

@ -9,7 +9,7 @@ echo \kernel\helpers\Html::h(2, "Форма авторизации/регист
$form = new ActiveForm();
$form->beginForm("/admin/module_shop_client/auth/");
$form->field(\itguild\forms\inputs\TextInput::class, 'email', [
$form->field(\itguild\forms\inputs\EmailInput::class, 'email', [
'class' => "form-control",
'placeholder' => 'Email',
])

View File

@ -6,6 +6,7 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public string $migration;
/**
* Run the migrations.
*/

View File

@ -5,17 +5,22 @@ namespace kernel\modules\post;
use kernel\helpers\Debug;
use kernel\Module;
use kernel\modules\menu\service\MenuService;
use kernel\services\MigrationService;
class PostModule extends Module
{
public MenuService $menuService;
public MigrationService $migrationService;
public function __construct()
{
$this->menuService = new MenuService();
$this->migrationService = new MigrationService();
}
public function init(): void
{
$this->migrationService->runAtPath("{KERNEL_MODULES}/post/migrations");
$this->menuService->createItem([
"label" => "Посты",
"url" => "/admin/post",
@ -26,5 +31,6 @@ class PostModule extends Module
public function deactivate(): void
{
$this->menuService->removeItemBySlug("post");
$this->migrationService->rollbackAtPath("{KERNEL_MODULES}/post/migrations");
}
}

View File

@ -6,6 +6,8 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public string $migration;
/**
* Run the migrations.
*/

View File

@ -3,16 +3,13 @@
/**
* @var \Illuminate\Database\Eloquent\Collection $contents
* @var int $page_number
* @var \kernel\CgView $view
*/
use kernel\IGTabel\action_column\DeleteActionColumn;
use kernel\IGTabel\action_column\EditActionColumn;
use kernel\IGTabel\action_column\ViewActionColumn;
use kernel\modules\post\models\Post;
use kernel\modules\user\models\User;
use Itguild\EloquentTable\EloquentDataProvider;
use Itguild\EloquentTable\ListEloquentTable;
use kernel\IGTabel\btn\PrimaryBtn;
use kernel\widgets\IconBtn\IconBtnCreateWidget;
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
use kernel\widgets\IconBtn\IconBtnEditWidget;
@ -25,6 +22,11 @@ $table = new ListEloquentTable(new EloquentDataProvider(Post::class, [
'baseUrl' => "/admin/post"
]));
$view->setTitle("Список постов");
$view->setMeta([
'description' => 'Список постов системы'
]);
$entityRelation = new \kernel\EntityRelation();
$additionals = $entityRelation->getEntityRelationsBySlug("post");

View File

@ -7,9 +7,6 @@
use kernel\modules\user\models\User;
use Itguild\EloquentTable\ViewEloquentTable;
use Itguild\EloquentTable\ViewJsonTableEloquentModel;
use kernel\IGTabel\btn\DangerBtn;
use kernel\IGTabel\btn\PrimaryBtn;
use kernel\IGTabel\btn\SuccessBtn;
use kernel\widgets\IconBtn\IconBtnDeleteWidget;
use kernel\widgets\IconBtn\IconBtnEditWidget;
use kernel\widgets\IconBtn\IconBtnListWidget;

View File

@ -36,14 +36,16 @@ class SecureRestController extends RestController
$res = [];
if ($model) {
if (password_verify($data["password"], $model->password_hash)) {
$model->access_token_expires_at = date("Y-m-d H:i:s", strtotime(App::$secure['token_expired_time']));
$model->access_token = match (App::$secure['token_type']) {
"JWT" => TokenService::JWT($_ENV['SECRET_KEY'], 'HS256'),
"md5" => TokenService::md5(),
"crypt" => TokenService::crypt(),
"hash" => TokenService::hash('sha256'),
default => TokenService::random_bytes(20),
};
if ($model->access_token_expires_at < date("Y-m-d H:i:s") or $model->access_token === null){
$model->access_token_expires_at = date("Y-m-d H:i:s", strtotime(App::$secure['token_expired_time']));
$model->access_token = match (App::$secure['token_type']) {
"JWT" => TokenService::JWT($_ENV['SECRET_KEY'], 'HS256'),
"md5" => TokenService::md5(),
"crypt" => TokenService::crypt(),
"hash" => TokenService::hash('sha256'),
default => TokenService::random_bytes(20),
};
}
$res = [
"access_token" => $model->access_token,

View File

@ -6,6 +6,8 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public string $migration;
/**
* Run the migrations.
*/

View File

@ -6,6 +6,8 @@ use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public string $migration;
/**
* Run the migrations.
*