Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 43101cf65c | |||
| 90ec913abc | |||
| 22ec3a3380 | |||
| 423f274c73 | |||
| b656f9302e |
+1
-1
@@ -14,5 +14,5 @@ trim_trailing_whitespace = false
|
|||||||
[*.{yml,yaml}]
|
[*.{yml,yaml}]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
[docker-compose.yml]
|
[compose.yaml]
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Modules\Test\App\Http\Controllers;
|
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
|
||||||
use Illuminate\Http\RedirectResponse;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\Response;
|
|
||||||
|
|
||||||
class TestController extends Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
return view('test::index');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for creating a new resource.
|
|
||||||
*/
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
return view('test::create');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*/
|
|
||||||
public function store(Request $request): RedirectResponse
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the specified resource.
|
|
||||||
*/
|
|
||||||
public function show($id)
|
|
||||||
{
|
|
||||||
return view('test::show');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for editing the specified resource.
|
|
||||||
*/
|
|
||||||
public function edit($id)
|
|
||||||
{
|
|
||||||
return view('test::edit');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*/
|
|
||||||
public function update(Request $request, $id): RedirectResponse
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*/
|
|
||||||
public function destroy($id)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Modules\Test\App\Providers;
|
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
|
||||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
|
||||||
|
|
||||||
class RouteServiceProvider extends ServiceProvider
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The module namespace to assume when generating URLs to actions.
|
|
||||||
*/
|
|
||||||
protected string $moduleNamespace = 'Modules\Test\App\Http\Controllers';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called before routes are registered.
|
|
||||||
*
|
|
||||||
* Register any model bindings or pattern based filters.
|
|
||||||
*/
|
|
||||||
public function boot(): void
|
|
||||||
{
|
|
||||||
parent::boot();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define the routes for the application.
|
|
||||||
*/
|
|
||||||
public function map(): void
|
|
||||||
{
|
|
||||||
$this->mapApiRoutes();
|
|
||||||
|
|
||||||
$this->mapWebRoutes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define the "web" routes for the application.
|
|
||||||
*
|
|
||||||
* These routes all receive session state, CSRF protection, etc.
|
|
||||||
*/
|
|
||||||
protected function mapWebRoutes(): void
|
|
||||||
{
|
|
||||||
Route::middleware('web')
|
|
||||||
->namespace($this->moduleNamespace)
|
|
||||||
->group(module_path('Test', '/routes/web.php'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define the "api" routes for the application.
|
|
||||||
*
|
|
||||||
* These routes are typically stateless.
|
|
||||||
*/
|
|
||||||
protected function mapApiRoutes(): void
|
|
||||||
{
|
|
||||||
Route::prefix('api')
|
|
||||||
->middleware('api')
|
|
||||||
->namespace($this->moduleNamespace)
|
|
||||||
->group(module_path('Test', '/routes/api.php'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Modules\Test\App\Providers;
|
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Blade;
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
|
|
||||||
class TestServiceProvider extends ServiceProvider
|
|
||||||
{
|
|
||||||
protected string $moduleName = 'Test';
|
|
||||||
|
|
||||||
protected string $moduleNameLower = 'test';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Boot the application events.
|
|
||||||
*/
|
|
||||||
public function boot(): void
|
|
||||||
{
|
|
||||||
$this->registerCommands();
|
|
||||||
$this->registerCommandSchedules();
|
|
||||||
$this->registerTranslations();
|
|
||||||
$this->registerConfig();
|
|
||||||
$this->registerViews();
|
|
||||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/migrations'));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the service provider.
|
|
||||||
*/
|
|
||||||
public function register(): void
|
|
||||||
{
|
|
||||||
$this->app->register(RouteServiceProvider::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register commands in the format of Command::class
|
|
||||||
*/
|
|
||||||
protected function registerCommands(): void
|
|
||||||
{
|
|
||||||
// $this->commands([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register command Schedules.
|
|
||||||
*/
|
|
||||||
protected function registerCommandSchedules(): void
|
|
||||||
{
|
|
||||||
// $this->app->booted(function () {
|
|
||||||
// $schedule = $this->app->make(Schedule::class);
|
|
||||||
// $schedule->command('inspire')->hourly();
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register translations.
|
|
||||||
*/
|
|
||||||
public function registerTranslations(): void
|
|
||||||
{
|
|
||||||
$langPath = resource_path('lang/modules/'.$this->moduleNameLower);
|
|
||||||
|
|
||||||
if (is_dir($langPath)) {
|
|
||||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
|
||||||
$this->loadJsonTranslationsFrom($langPath);
|
|
||||||
} else {
|
|
||||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
|
||||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register config.
|
|
||||||
*/
|
|
||||||
protected function registerConfig(): void
|
|
||||||
{
|
|
||||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
|
|
||||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register views.
|
|
||||||
*/
|
|
||||||
public function registerViews(): void
|
|
||||||
{
|
|
||||||
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
|
|
||||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
|
||||||
|
|
||||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']);
|
|
||||||
|
|
||||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
|
||||||
|
|
||||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.config('modules.paths.generator.component-class.path'));
|
|
||||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the services provided by the provider.
|
|
||||||
*/
|
|
||||||
public function provides(): array
|
|
||||||
{
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getPublishableViewPaths(): array
|
|
||||||
{
|
|
||||||
$paths = [];
|
|
||||||
foreach (config('view.paths') as $path) {
|
|
||||||
if (is_dir($path.'/modules/'.$this->moduleNameLower)) {
|
|
||||||
$paths[] = $path.'/modules/'.$this->moduleNameLower;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $paths;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Modules\Test\Database\Seeders;
|
|
||||||
|
|
||||||
use Illuminate\Database\Seeder;
|
|
||||||
|
|
||||||
class TestDatabaseSeeder extends Seeder
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the database seeds.
|
|
||||||
*/
|
|
||||||
public function run(): void
|
|
||||||
{
|
|
||||||
// $this->call([]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "nwidart/test",
|
|
||||||
"description": "",
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Nicolas Widart",
|
|
||||||
"email": "n.widart@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"extra": {
|
|
||||||
"laravel": {
|
|
||||||
"providers": [],
|
|
||||||
"aliases": {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Modules\\Test\\": "",
|
|
||||||
"Modules\\Test\\App\\": "app/",
|
|
||||||
"Modules\\Test\\Database\\Factories\\": "database/factories/",
|
|
||||||
"Modules\\Test\\Database\\Seeders\\": "database/seeders/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload-dev": {
|
|
||||||
"psr-4": {
|
|
||||||
"Modules\\Test\\Tests\\": "tests/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
'name' => 'Test',
|
|
||||||
];
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Test",
|
|
||||||
"alias": "test",
|
|
||||||
"description": "",
|
|
||||||
"keywords": [],
|
|
||||||
"priority": 0,
|
|
||||||
"providers": [
|
|
||||||
"Modules\\Test\\App\\Providers\\TestServiceProvider"
|
|
||||||
],
|
|
||||||
"files": []
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"private": true,
|
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
|
||||||
"dev": "vite",
|
|
||||||
"build": "vite build"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"axios": "^1.1.2",
|
|
||||||
"laravel-vite-plugin": "^0.7.5",
|
|
||||||
"sass": "^1.69.5",
|
|
||||||
"postcss": "^8.3.7",
|
|
||||||
"vite": "^4.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
@extends('test::layouts.master')
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
<h1>Hello World</h1>
|
|
||||||
|
|
||||||
<p>Module: {!! config('test.name') !!}</p>
|
|
||||||
@endsection
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
|
|
||||||
<title>Test Module - {{ config('app.name', 'Laravel') }}</title>
|
|
||||||
|
|
||||||
<meta name="description" content="{{ $description ?? '' }}">
|
|
||||||
<meta name="keywords" content="{{ $keywords ?? '' }}">
|
|
||||||
<meta name="author" content="{{ $author ?? '' }}">
|
|
||||||
|
|
||||||
<!-- Fonts -->
|
|
||||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
|
||||||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
|
|
||||||
|
|
||||||
{{-- Vite CSS --}}
|
|
||||||
{{-- {{ module_vite('build-test', 'resources/assets/sass/app.scss') }} --}}
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
@yield('content')
|
|
||||||
|
|
||||||
{{-- Vite JS --}}
|
|
||||||
{{-- {{ module_vite('build-test', 'resources/assets/js/app.js') }} --}}
|
|
||||||
</body>
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Support\Facades\Route;
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| API Routes
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here is where you can register API routes for your application. These
|
|
||||||
| routes are loaded by the RouteServiceProvider within a group which
|
|
||||||
| is assigned the "api" middleware group. Enjoy building your API!
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
Route::middleware(['auth:sanctum'])->prefix('v1')->name('api.')->group(function () {
|
|
||||||
Route::get('test', fn (Request $request) => $request->user())->name('test');
|
|
||||||
});
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
|
||||||
use Modules\Test\App\Http\Controllers\TestController;
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Web Routes
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here is where you can register web routes for your application. These
|
|
||||||
| routes are loaded by the RouteServiceProvider within a group which
|
|
||||||
| contains the "web" middleware group. Now create something great!
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
Route::group([], function () {
|
|
||||||
Route::resource('test', TestController::class)->names('test');
|
|
||||||
});
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import { defineConfig } from 'vite';
|
|
||||||
import laravel from 'laravel-vite-plugin';
|
|
||||||
|
|
||||||
export default defineConfig({
|
|
||||||
build: {
|
|
||||||
outDir: '../../public/build-test',
|
|
||||||
emptyOutDir: true,
|
|
||||||
manifest: true,
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
laravel({
|
|
||||||
publicDirectory: '../../public',
|
|
||||||
buildDirectory: 'build-test',
|
|
||||||
input: [
|
|
||||||
__dirname + '/resources/assets/sass/app.scss',
|
|
||||||
__dirname + '/resources/assets/js/app.js'
|
|
||||||
],
|
|
||||||
refresh: true,
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
//export const paths = [
|
|
||||||
// 'Modules/$STUDLY_NAME$/resources/assets/sass/app.scss',
|
|
||||||
// 'Modules/$STUDLY_NAME$/resources/assets/js/app.js',
|
|
||||||
//];
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use App\Models\TestData;
|
|
||||||
|
|
||||||
class testDataCommand extends Command
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name and signature of the console command.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $signature = 'data_base:test-data-command';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The console command description.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $description = 'Тестовая команда';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the console command.
|
|
||||||
*/
|
|
||||||
public function handle()
|
|
||||||
{
|
|
||||||
$testDataModel = new TestData;
|
|
||||||
$test = TestData::where('test_char', 'hellos')->get();
|
|
||||||
var_dump($test);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Models\AccessModel;
|
|
||||||
|
|
||||||
class AccessListController extends Controller
|
|
||||||
{
|
|
||||||
public function getAccess($id = null)
|
|
||||||
{
|
|
||||||
$accessListModel = new AccessModel();
|
|
||||||
$accessListData = $accessListModel::where(['access_id' => $id])->select('access_id')->get();
|
|
||||||
if ($id) {
|
|
||||||
echo '<pre>'; var_dump($accessListData->toArray()); echo'</pre>';
|
|
||||||
} else {
|
|
||||||
var_dump($accessListModel::all());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public function postAccess(Request $rqst)
|
|
||||||
{
|
|
||||||
$accessListModel = new AccessModel();
|
|
||||||
$accessListModel->role = $rqst['role'];
|
|
||||||
$accessListModel->title = $rqst['title'];
|
|
||||||
$accessListModel->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function delAccess($id)
|
|
||||||
{
|
|
||||||
$accessListModel = new AccessModel();
|
|
||||||
//$accessListModel::where(['access_id' => $id])->delete();
|
|
||||||
$accessListModel::destroy($id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Http\Response;
|
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
|
|
||||||
class TestController extends Controller
|
|
||||||
{
|
|
||||||
public function getRoles()
|
|
||||||
{
|
|
||||||
$roles = DB::connection('mysql')->table('arch_lk_access_list')->select(['*'])->get();
|
|
||||||
return view('roles', ['roles' => $roles]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function getAccess($id)
|
|
||||||
{
|
|
||||||
$roles = DB::connection('mysql')->table('arch_lk_access_list')->select(['*'])->where('access_id', '=', $id)->get();
|
|
||||||
$response = new Response(json_encode($roles[0]));
|
|
||||||
$response->header('Content-type', 'text/plain');
|
|
||||||
$response->header('Access-Control-Allow-Methods', 'POST');
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function redirect()
|
|
||||||
{
|
|
||||||
// return redirect()->away('https://google.com');
|
|
||||||
//return redirect()->action([TestController::class, 'getAccess'], ['id' => 3]);
|
|
||||||
return redirect()->route('getAccessById', ['id' => 2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getParam(Request $rqst)
|
|
||||||
{
|
|
||||||
//echo '<pre>'; var_dump($rqst->cookie('test_cookie')); echo'</pre>';
|
|
||||||
//return response('test')->cookie('test_cookie', $rqst->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setRole(Request $rqst)
|
|
||||||
{
|
|
||||||
$lastInsert = DB::connection('mysql')->table('arch_lk_access_list')->insertGetId(['role' => $rqst->roleName, 'title' => $rqst->roleTitle]);
|
|
||||||
return redirect()->route('get_role');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function delRole(Request $rqst)
|
|
||||||
{
|
|
||||||
$lastInsert = DB::connection('mysql')->table('arch_lk_access_list')->where('access_id', '=', $rqst->access_id)->delete();
|
|
||||||
return redirect()->route('get_role');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use App\Models\TestData;
|
|
||||||
|
|
||||||
class TestDataController extends Controller
|
|
||||||
{
|
|
||||||
public function insertNewData(Request $rqst)
|
|
||||||
{
|
|
||||||
$model = new TestData;
|
|
||||||
$model->test_int = $rqst->int;
|
|
||||||
$model->test_char = $rqst->char;
|
|
||||||
|
|
||||||
$model->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use App\Models\TestFormModel;
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class TestFormController extends Controller
|
|
||||||
{
|
|
||||||
public function getForm()
|
|
||||||
{
|
|
||||||
return view('test_form');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setForm(Request $rqst)
|
|
||||||
{
|
|
||||||
$testTable = new TestFormModel;
|
|
||||||
$testTable->first_name = $rqst->first_name;
|
|
||||||
$testTable->last_name = $rqst->last_name;
|
|
||||||
$testTable->department_name = $rqst->department_name;
|
|
||||||
$testTable->save();
|
|
||||||
|
|
||||||
return redirect('/test_table');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class AccessModel extends Model
|
|
||||||
{
|
|
||||||
use HasFactory;
|
|
||||||
|
|
||||||
protected $connection = 'mysql';
|
|
||||||
protected $table = 'tm_lk_access_list';
|
|
||||||
public $timestamps = false;
|
|
||||||
protected $primaryKey = 'access_id';
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class TestData extends Model
|
|
||||||
{
|
|
||||||
use HasFactory;
|
|
||||||
protected $table = 'test_data';
|
|
||||||
protected $connection = 'mysql';
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models;
|
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
|
||||||
|
|
||||||
class TestFormModel extends Model
|
|
||||||
{
|
|
||||||
use HasFactory;
|
|
||||||
|
|
||||||
protected $connection = 'mysql';
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Providers;
|
|
||||||
|
|
||||||
// use Illuminate\Support\Facades\Gate;
|
|
||||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Провайдер для регистрации сервиса аутентификации
|
|
||||||
*/
|
|
||||||
class AuthServiceProvider extends ServiceProvider
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The model to policy mappings for the application.
|
|
||||||
*
|
|
||||||
* @var array<class-string, class-string>
|
|
||||||
*/
|
|
||||||
protected $policies = [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register any authentication / authorization services.
|
|
||||||
*/
|
|
||||||
public function boot(): void
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Providers;
|
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Broadcast;
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
|
|
||||||
class BroadcastServiceProvider extends ServiceProvider
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Bootstrap any application services.
|
|
||||||
*/
|
|
||||||
public function boot(): void
|
|
||||||
{
|
|
||||||
Broadcast::routes();
|
|
||||||
|
|
||||||
require base_path('routes/channels.php');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Providers;
|
|
||||||
|
|
||||||
use Illuminate\Auth\Events\Registered;
|
|
||||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
|
||||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
|
||||||
use Illuminate\Support\Facades\Event;
|
|
||||||
|
|
||||||
class EventServiceProvider extends ServiceProvider
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The event to listener mappings for the application.
|
|
||||||
*
|
|
||||||
* @var array<class-string, array<int, class-string>>
|
|
||||||
*/
|
|
||||||
protected $listen = [
|
|
||||||
Registered::class => [
|
|
||||||
SendEmailVerificationNotification::class,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register any events for your application.
|
|
||||||
*/
|
|
||||||
public function boot(): void
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if events and listeners should be automatically discovered.
|
|
||||||
*/
|
|
||||||
public function shouldDiscoverEvents(): bool
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,21 +2,24 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class DatabaseSeeder extends Seeder
|
class DatabaseSeeder extends Seeder
|
||||||
{
|
{
|
||||||
|
use WithoutModelEvents;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Seed the application's database.
|
* Seed the application's database.
|
||||||
*/
|
*/
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
// \App\Models\User::factory(10)->create();
|
// User::factory(10)->create();
|
||||||
|
|
||||||
// \App\Models\User::factory()->create([
|
User::factory()->create([
|
||||||
// 'name' => 'Test User',
|
'name' => 'Test User',
|
||||||
// 'email' => 'test@example.com',
|
'email' => 'test@example.com',
|
||||||
// ]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-4
@@ -19,14 +19,17 @@
|
|||||||
</source>
|
</source>
|
||||||
<php>
|
<php>
|
||||||
<env name="APP_ENV" value="testing"/>
|
<env name="APP_ENV" value="testing"/>
|
||||||
|
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
|
||||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||||
<env name="CACHE_DRIVER" value="array"/>
|
<env name="BROADCAST_CONNECTION" value="null"/>
|
||||||
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
|
<env name="CACHE_STORE" value="array"/>
|
||||||
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
|
<env name="DB_CONNECTION" value="sqlite"/>
|
||||||
|
<env name="DB_DATABASE" value=":memory:"/>
|
||||||
<env name="MAIL_MAILER" value="array"/>
|
<env name="MAIL_MAILER" value="array"/>
|
||||||
<env name="PULSE_ENABLED" value="false"/>
|
|
||||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||||
<env name="SESSION_DRIVER" value="array"/>
|
<env name="SESSION_DRIVER" value="array"/>
|
||||||
|
<env name="PULSE_ENABLED" value="false"/>
|
||||||
<env name="TELESCOPE_ENABLED" value="false"/>
|
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||||
|
<env name="NIGHTWATCH_ENABLED" value="false"/>
|
||||||
</php>
|
</php>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/* ГАВРИЛОВ. ВЫЯСНИТЬ, ГДЕ ИСПОЛЬЗУЮТСЯ */
|
||||||
|
|
||||||
|
#root{
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-container{
|
||||||
|
|
||||||
|
&.form-container--small-size{
|
||||||
|
width: 30%;
|
||||||
|
}
|
||||||
|
&.form-container--medium-size{
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.form-container--left-pos{
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
&.form-container--mid-pos{
|
||||||
|
margin: 25px auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.form__field-block{
|
||||||
|
margin: 15px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-block{
|
||||||
|
margin: 15px 0;
|
||||||
|
padding: 15px 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* OVERWRITE */
|
||||||
|
.renButton{
|
||||||
|
|
||||||
|
&.renButton--tertiary{
|
||||||
|
background: #dfdfdf;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
#page__content-block{
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#page__header-block{
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 99;
|
||||||
|
box-shadow: 0px 2px 9px 3px #8f8d8d;
|
||||||
|
|
||||||
|
& .header-block__header-container{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 10px;
|
||||||
|
background: var(--color_graphite_main);
|
||||||
|
|
||||||
|
& .header-container__block{
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
& .header-container__block__app-name{
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
:root{
|
||||||
|
--color_graphite_main: #323e48;
|
||||||
|
--color_emerald_main: #77cb10;
|
||||||
|
--color_emerald_light: #95fa77;
|
||||||
|
--color_ruby_main: #ff0078;
|
||||||
|
--color_purple_main: #7864eb;
|
||||||
|
}
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
import { useState } from 'react';
|
|
||||||
import { MagicPopupType } from '../../components/MagicPopupContainer';
|
|
||||||
|
|
||||||
export const MagicPopupHook = () => {
|
|
||||||
// //Стейт с набором попапов для отрисовки
|
|
||||||
// const [popupArr, setPopupArr] = useState<MagicPopupType[] | []>( [] );
|
|
||||||
// //ИСПОЛЬЗОВАНИЕ USECALLBACK? я не использую его для функций удаления и добавления новых попапов в этом хуке, что должно приводить к созданию новых экземпляров функций каждый вызов хука (удаление, добавления попапа). Функция добавления попапа является пропсом для TaxiForm, значит, содание нового экземпляра функции добавления попапа в хуке должно вызывать перерендер TaxiForm? Но я его не замечаю (нет мигания в дом дереве элемента где рендерится TaxiForm ни при создании, не при удалении попапа)
|
|
||||||
|
|
||||||
// //Колбэк для добавление нового попапа. Его нужно передавать в каждый компонент, где планируется вызывать попапы. В аргументы этого колбэка передаются объекты с информацией для каждого попапа (текст, таймер и т.д.)
|
|
||||||
// function addPopup (newPopupArrData: MagicPopupType[]) {
|
|
||||||
// setPopupArr(prev => {
|
|
||||||
// //Конкатенируем предыдущее состояние набора попапов и новые попапы, присваивая новому попапу параметр id с уникальным рандомным значением
|
|
||||||
// return [...prev, ...newPopupArrData].map(popup => popup.id ? popup : {...popup, id: getRandomId()})
|
|
||||||
// });
|
|
||||||
// };
|
|
||||||
|
|
||||||
// //Колбэк для удаления попапа из набора
|
|
||||||
// function delPopup (popupDelKey: number) {
|
|
||||||
// setPopupArr(prev => {
|
|
||||||
// return prev.filter(popup => popup.id !== popupDelKey);
|
|
||||||
// });
|
|
||||||
// };
|
|
||||||
|
|
||||||
// //Функция генерации случайного числа для формирования на его основе уникального идентификатора для каждого компонента попаппа
|
|
||||||
// function getRandomId(): number { return Date.now() - Math.random() };
|
|
||||||
|
|
||||||
// return {
|
|
||||||
// popupArr,
|
|
||||||
// addPopup,
|
|
||||||
// delPopup,
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import React, { useState } from "react";
|
|
||||||
import Preloader from "../../components/preloader/Preloader";
|
|
||||||
|
|
||||||
//Хук для формирования пропсов управления состояний прелоадера, экспортируемых в компоненты страницы, где планируется вызывать прелоадер
|
|
||||||
export const MagicPreloaderHook = () => {
|
|
||||||
//Стейт для видимости прелоадера
|
|
||||||
const [preloaderVisibleState, setPreloaderVisibleState] = useState<boolean>(true);
|
|
||||||
//Стейт для текста прелоадера
|
|
||||||
const [preloaderTextState, setPreloaderTextState] = useState<string>('загрузка');
|
|
||||||
//Сеттер для смены состояний прелоадера
|
|
||||||
function setPreloaderParams (visibleState: boolean, textState?: string)
|
|
||||||
{
|
|
||||||
setPreloaderVisibleState(visibleState)
|
|
||||||
textState ? setPreloaderTextState(textState) : true, []
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
|
||||||
setPreloaderParams,
|
|
||||||
PreloaderComponent: ( {preloaderVisible = preloaderVisibleState, preloaderText = preloaderTextState} ) => (
|
|
||||||
<Preloader
|
|
||||||
visible={preloaderVisible}
|
|
||||||
text={preloaderText}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { createRoot } from 'react-dom/client';
|
||||||
|
import { UIKitThemeProvider } from '@SharePoint/rencredit_uikit';
|
||||||
|
import Header from "./components/header/Header.tsx";
|
||||||
|
|
||||||
|
const headerBlock:HTMLElement = document.getElementById('page__header-block')!;
|
||||||
|
const headerRoot = createRoot(headerBlock);
|
||||||
|
|
||||||
|
console.log('da')
|
||||||
|
|
||||||
|
headerRoot.render(
|
||||||
|
<UIKitThemeProvider>
|
||||||
|
<Header />
|
||||||
|
</UIKitThemeProvider>
|
||||||
|
);
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import React, { ReactNode } from "react";
|
||||||
|
import { UIKitThemeProvider } from '@SharePoint/rencredit_uikit';
|
||||||
|
import { PopupProvider } from "../contexts/PopupContext.tsx";
|
||||||
|
import { PreloaderProvider } from "../contexts/PreloaderContext.tsx";
|
||||||
|
|
||||||
|
interface AppProviderProps{
|
||||||
|
children: ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AppProvider({children}: AppProviderProps){
|
||||||
|
|
||||||
|
return (
|
||||||
|
<UIKitThemeProvider>
|
||||||
|
<PopupProvider>
|
||||||
|
<PreloaderProvider>
|
||||||
|
{children}
|
||||||
|
</PreloaderProvider>
|
||||||
|
</PopupProvider>
|
||||||
|
</UIKitThemeProvider>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Сервис для полуения csrt токена для размещения в формах
|
||||||
|
* @date 24.07.2025
|
||||||
|
* @author dgavrilov
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const getCsrfToken = ():string => {
|
||||||
|
const METATAG:HTMLElement|null = document.querySelector('meta[name="csrf-token"]');
|
||||||
|
|
||||||
|
if (!METATAG) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
const CSRFTOKEN:string|null = METATAG.getAttribute('content');
|
||||||
|
if (!CSRFTOKEN) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return CSRFTOKEN;
|
||||||
|
}
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
@vite(['resources/js/app.js', 'resources/css/app.css'])
|
|
||||||
<title>Страница с ролями</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<p>{{ $roleData }}</p>
|
|
||||||
<!-- <div id='root'></div>
|
|
||||||
<div id='counter'></div> -->
|
|
||||||
|
|
||||||
|
|
||||||
<script type="module">
|
|
||||||
//import Example from './Example.js';
|
|
||||||
// Передаем данные напрямую в компонент
|
|
||||||
const props = {!! $roleData !!};
|
|
||||||
console.log(props)
|
|
||||||
console.log('da')
|
|
||||||
//ReactDOM.render(<App {...props} />, document.getElementById('root'));
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Laravel + React + Inertia</title>
|
|
||||||
@viteReactRefresh <!-- без это директивы возникает ошибка "React refresh preamble was not loaded. Something is wrong" Эта директива подключает скрипт горячей перезагрузки, но вообще этот скрипт должен подключаться при использовании плагина @vitejs/plugin-react -->
|
|
||||||
@vite(['resources/js/app.jsx']) <!-- Подключение Inertia и React -->
|
|
||||||
<!-- Гаврилов. нам не нужна больше inertia. Убрать? -->
|
|
||||||
@inertiaHead <!-- попробовать убрать, получится ли тянуть css стили без явного указания -->
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<!-- Гаврилов. нам не нужна больше inertia. Убрать? -->
|
|
||||||
@inertia
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>Страница с ролями</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<table style=border:1px solid black>
|
|
||||||
<tr>
|
|
||||||
<th>id роли</th>
|
|
||||||
<th>имя роли</th>
|
|
||||||
<th>заголовок роли</th>
|
|
||||||
<th>удалить</th>
|
|
||||||
</tr>
|
|
||||||
@foreach($roles as $role)
|
|
||||||
<tr>
|
|
||||||
<td>{{ $role->access_id }}</td>
|
|
||||||
<td>{{ $role->role }}</td>
|
|
||||||
<td>{{ $role->title }}</td>
|
|
||||||
<td>
|
|
||||||
<form method="POST" action="{{ url('role_del') }}">
|
|
||||||
@csrf
|
|
||||||
<input type="hidden" name="access_id" value="{{ $role->access_id }}">
|
|
||||||
<button type='submit'>Удалить</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<form method="POST" action="{{ url('role') }}">
|
|
||||||
@csrf
|
|
||||||
<label for="input-email">Имя</label>
|
|
||||||
<input type="text" id="input-name" name="roleName" placeholder="Введите имя роли">
|
|
||||||
<label for="input-email">Заголовок</label>
|
|
||||||
<input type="text" id="input-title" name="roleTitle" placeholder="Введите заголовок роли">
|
|
||||||
<button type="submit">Отправить</button>
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<html>
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>Страница с ролями</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<form method="POST" action="{{ url('test_table') }}">
|
|
||||||
@csrf
|
|
||||||
<label for="first_name">Имя</label>
|
|
||||||
<input type="text" id="first_name" name="first_name" placeholder="Введите имя">
|
|
||||||
<label for="last_name">Фамилия</label>
|
|
||||||
<input type="text" id="last_name" name="last_name" placeholder="Введите фамилию">
|
|
||||||
<label for="department">Отдел</label>
|
|
||||||
<input type="text" id="department_name" name="department_name" placeholder="Введите отдел">
|
|
||||||
<button type="submit">Отправить</button>
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Broadcast;
|
|
||||||
|
|
||||||
/*
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
| Broadcast Channels
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| Here you may register all of the event broadcasting channels that your
|
|
||||||
| application supports. The given channel authorization callbacks are
|
|
||||||
| used to check if an authenticated user can listen to the channel.
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
|
|
||||||
return (int) $user->id === (int) $id;
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user