Compare commits

..

10 Commits

11 changed files with 351 additions and 151 deletions
+28 -34
View File
@@ -4,55 +4,36 @@ APP_KEY=
APP_DEBUG=true APP_DEBUG=true
APP_URL=http://localhost APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
# PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug LOG_LEVEL=debug
DB_CONNECTION=sqlite DB_CONNECTION=mysql
# DB_HOST=127.0.0.1 DB_HOST=127.0.0.1
# DB_PORT=3306 DB_PORT=3306
# DB_DATABASE=laravel DB_DATABASE=laravel
# DB_USERNAME=root DB_USERNAME=root
# DB_PASSWORD= DB_PASSWORD=
SESSION_DRIVER=database BROADCAST_DRIVER=log
SESSION_LIFETIME=120 CACHE_DRIVER=file
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local FILESYSTEM_DISK=local
QUEUE_CONNECTION=database QUEUE_CONNECTION=sync
SESSION_DRIVER=file
CACHE_STORE=database SESSION_LIFETIME=120
# CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1 MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1 REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null REDIS_PASSWORD=null
REDIS_PORT=6379 REDIS_PORT=6379
MAIL_MAILER=log MAIL_MAILER=smtp
MAIL_SCHEME=null MAIL_HOST=mailpit
MAIL_HOST=127.0.0.1 MAIL_PORT=1025
MAIL_PORT=2525
MAIL_USERNAME=null MAIL_USERNAME=null
MAIL_PASSWORD=null MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com" MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}" MAIL_FROM_NAME="${APP_NAME}"
@@ -62,4 +43,17 @@ AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET= AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
VITE_APP_NAME="${APP_NAME}" VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
+10 -15
View File
@@ -1,24 +1,19 @@
*.log
.DS_Store
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
/.fleet
/.idea
/.nova
/.phpunit.cache /.phpunit.cache
/.vscode
/.zed
/auth.json
/node_modules /node_modules
/public/build /public/build
/public/hot /public/hot
/public/storage /public/storage
/storage/*.key /storage/*.key
/storage/pail
/vendor /vendor
.env
.env.backup
.env.production
.phpunit.result.cache
Homestead.json Homestead.json
Homestead.yaml Homestead.yaml
Thumbs.db auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode
BIN
View File
Binary file not shown.
+83
View File
@@ -0,0 +1,83 @@
<?php
namespace App\Http;
use App\Http\Middleware\CheckUserAppAccess;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* These middleware are run during every request to your application.
*
* @var array<int, class-string|string>
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
* The application's route middleware groups.
*
* @var array<string, array<int, class-string|string>>
*/
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\App\Http\Middleware\AuthenticateMagic::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
\App\Http\Middleware\EncryptCookies::class,
//\Illuminate\Session\Middleware\StartSession::class,
//\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
'throttle:api',
//\Illuminate\Routing\Middleware\SubstituteBindings::class,
//\Illuminate\Session\Middleware\AuthenticateSession::class, // Опционально
//\Illuminate\Auth\Middleware\Authenticate::class.':sanctum', // Глобальная аутентификация
//Кастомный посредник аутентификации, который наследует стандартному посреднику аутентификации с передачей guarda sanctum. Сначала в кастомном посреднике будет проведена аутентификация sanctum, если будет выброшена ошибка, она будет обработана кастомным посредником (с возвратом сообщения об ошибке и корректного статуса). Без этой реализации стандартный посредник аутентификации пытался редиректить на роут login, которого не должно быть при обращении к api ендпоинту
\App\Http\Middleware\AuthenticateMagicApi::class.':sanctum',
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
];
/**
* The application's middleware aliases.
*
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
*
* @var array<string, class-string|string>
*/
protected $middlewareAliases = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
'signed' => \App\Http\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
//Посредник проверки доступных ролей в приложении
'checkPermission' => \App\Http\Middleware\CheckUserPermission::class,
//Посредник проверки доступа к приложению
'checkAppAccess' => \App\Http\Middleware\CheckUserAppAccess::class,
];
}
+92 -23
View File
@@ -1,5 +1,8 @@
<?php <?php
use Illuminate\Support\Facades\Facade;
use Illuminate\Support\ServiceProvider;
return [ return [
/* /*
@@ -7,9 +10,9 @@ return [
| Application Name | Application Name
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| This value is the name of your application, which will be used when the | This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or | framework needs to place the application's name in a notification or
| other UI elements where an application name needs to be displayed. | any other location as required by the application or its packages.
| |
*/ */
@@ -48,24 +51,28 @@ return [
| |
| This URL is used by the console to properly generate URLs when using | This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of | the Artisan command line tool. You should set this to the root of
| the application so that it's available within Artisan commands. | your application so that it is used when running Artisan tasks.
| |
*/ */
'url' => env('APP_URL', 'http://localhost'), 'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Application Timezone | Application Timezone
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may specify the default timezone for your application, which | Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. The timezone | will be used by the PHP date and date-time functions. We have gone
| is set to "UTC" by default as it is suitable for most use cases. | ahead and set this to a sensible default for you out of the box.
| |
*/ */
'timezone' => 'UTC', #Гаврилов
//ПОМЕНЯТЬ НА ПРОДЕ
'timezone' => 'Europe/Moscow',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -73,37 +80,54 @@ return [
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| The application locale determines the default locale that will be used | The application locale determines the default locale that will be used
| by Laravel's translation / localization methods. This option can be | by the translation service provider. You are free to set this value
| set to any locale for which you plan to have translation strings. | to any of the locales which will be supported by the application.
| |
*/ */
'locale' => env('APP_LOCALE', 'en'), 'locale' => 'ru',
'fallback_locale' => 'en', // Резервный язык (если перевод отсутствует)
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'), /*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'), 'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'en_US',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Encryption Key | Encryption Key
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| This key is utilized by Laravel's encryption services and should be set | This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string to ensure that all encrypted values | to a random, 32 character string, otherwise these encrypted strings
| are secure. You should do this prior to deploying the application. | will not be safe. Please do this before deploying an application!
| |
*/ */
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'), 'key' => env('APP_KEY'),
'previous_keys' => [ 'cipher' => 'AES-256-CBC',
...array_filter(
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
),
],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -119,8 +143,53 @@ return [
*/ */
'maintenance' => [ 'maintenance' => [
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'), 'driver' => 'file',
'store' => env('APP_MAINTENANCE_STORE', 'database'), // 'store' => 'redis',
], ],
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => ServiceProvider::defaultProviders()->merge([
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
App\Providers\AuthorizationServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
])->toArray(),
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => Facade::defaultAliases()->merge([
// 'Example' => App\Facades\Example::class,
])->toArray(),
'test_env' => env('TEST_ENV'),
//Время жизни сессии
'session_life_time' => env('SESSION_LIFETIME'),
]; ];
+16 -22
View File
@@ -9,13 +9,13 @@ return [
| Default Cache Store | Default Cache Store
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| This option controls the default cache store that will be used by the | This option controls the default cache connection that gets used while
| framework. This connection is utilized if another isn't explicitly | using this caching library. This connection is used when another is
| specified when running a cache operation inside the application. | not explicitly specified when executing a given caching function.
| |
*/ */
'default' => env('CACHE_STORE', 'database'), 'default' => env('CACHE_DRIVER', 'file'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -26,14 +26,17 @@ return [
| well as their drivers. You may even define multiple stores for the | well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches. | same cache driver to group types of items stored in your caches.
| |
| Supported drivers: "array", "database", "file", "memcached", | Supported drivers: "apc", "array", "database", "file",
| "redis", "dynamodb", "octane", | "memcached", "redis", "dynamodb", "octane", "null"
| "failover", "null"
| |
*/ */
'stores' => [ 'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [ 'array' => [
'driver' => 'array', 'driver' => 'array',
'serialize' => false, 'serialize' => false,
@@ -41,10 +44,9 @@ return [
'database' => [ 'database' => [
'driver' => 'database', 'driver' => 'database',
'connection' => env('DB_CACHE_CONNECTION'), 'table' => 'cache',
'table' => env('DB_CACHE_TABLE', 'cache'), 'connection' => null,
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'), 'lock_connection' => null,
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
], ],
'file' => [ 'file' => [
@@ -91,14 +93,6 @@ return [
'driver' => 'octane', 'driver' => 'octane',
], ],
'failover' => [
'driver' => 'failover',
'stores' => [
'database',
'array',
],
],
], ],
/* /*
@@ -106,12 +100,12 @@ return [
| Cache Key Prefix | Cache Key Prefix
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache | When utilizing the APC, database, memcached, Redis, or DynamoDB cache
| stores, there might be other applications using the same cache. For | stores there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions. | that reason, you may prefix every cache key to avoid collisions.
| |
*/ */
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'), 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
]; ];
+40 -43
View File
@@ -10,22 +10,26 @@ return [
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Here you may specify which of the database connections below you wish | Here you may specify which of the database connections below you wish
| to use as your default connection for database operations. This is | to use as your default connection for all database work. Of course
| the connection which will be utilized unless another connection | you may use many connections at once using the Database library.
| is explicitly specified when you execute a query / statement.
| |
*/ */
'default' => env('DB_CONNECTION', 'sqlite'), 'default' => env('DB_CONNECTION', 'mysql'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Database Connections | Database Connections
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Below are all of the database connections defined for your application. | Here are each of the database connections setup for your application.
| An example configuration is provided for each database system which | Of course, examples of configuring each database platform that is
| is supported by Laravel. You're free to add / remove connections. | supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
| |
*/ */
@@ -33,80 +37,76 @@ return [
'sqlite' => [ 'sqlite' => [
'driver' => 'sqlite', 'driver' => 'sqlite',
'url' => env('DB_URL'), 'url' => env('DATABASE_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')), 'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '', 'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
'busy_timeout' => null,
'journal_mode' => null,
'synchronous' => null,
'transaction_mode' => 'DEFERRED',
], ],
'mysql' => [ 'mysql' => [
'driver' => 'mysql', 'driver' => 'mysql',
'url' => env('DB_URL'), 'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'), 'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'), 'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'), 'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME', 'root'), 'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''), 'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''), 'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'), 'charset' => 'utf8mb4',
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), 'collation' => 'utf8mb4_unicode_ci',
'prefix' => '', 'prefix' => '',
'prefix_indexes' => true, 'prefix_indexes' => true,
'strict' => true, 'strict' => true,
'engine' => null, 'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([ 'options' => extension_loaded('pdo_mysql') ? array_filter([
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'), PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [], ]) : [],
], ],
'mariadb' => [ 'magic_old' => [
'driver' => 'mariadb', 'driver' => 'mysql',
'url' => env('DB_URL'), 'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'), 'host' => env('DB_OLD_HOST'),
'port' => env('DB_PORT', '3306'), 'port' => env('DB_OLD_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'), 'database' => env('DB_OLD_DATABASE'),
'username' => env('DB_USERNAME', 'root'), 'username' => env('DB_OLD_USERNAME'),
'password' => env('DB_PASSWORD', ''), 'password' => env('DB_OLD_PASSWORD'),
'unix_socket' => env('DB_SOCKET', ''), 'unix_socket' => env('DB_OLD_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'), 'charset' => 'utf8mb4',
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), 'collation' => 'utf8mb4_unicode_ci',
'prefix' => '', 'prefix' => '',
'prefix_indexes' => true, 'prefix_indexes' => true,
'strict' => true, 'strict' => true,
'engine' => null, 'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([ 'options' => extension_loaded('pdo_mysql') ? array_filter([
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'), PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [], ]) : [],
], ],
'pgsql' => [ 'pgsql' => [
'driver' => 'pgsql', 'driver' => 'pgsql',
'url' => env('DB_URL'), 'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'), 'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'), 'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'), 'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'root'), 'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''), 'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'), 'charset' => 'utf8',
'prefix' => '', 'prefix' => '',
'prefix_indexes' => true, 'prefix_indexes' => true,
'search_path' => 'public', 'search_path' => 'public',
'sslmode' => env('DB_SSLMODE', 'prefer'), 'sslmode' => 'prefer',
], ],
'sqlsrv' => [ 'sqlsrv' => [
'driver' => 'sqlsrv', 'driver' => 'sqlsrv',
'url' => env('DB_URL'), 'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', 'localhost'), 'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'), 'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'), 'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'root'), 'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''), 'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'), 'charset' => 'utf8',
'prefix' => '', 'prefix' => '',
'prefix_indexes' => true, 'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'), // 'encrypt' => env('DB_ENCRYPT', 'yes'),
@@ -122,14 +122,11 @@ return [
| |
| This table keeps track of all the migrations that have already run for | This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of | your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run on the database. | the migrations on disk haven't actually been run in the database.
| |
*/ */
'migrations' => [ 'migrations' => 'migrations',
'table' => 'migrations',
'update_date_on_publish' => true,
],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
+30
View File
@@ -1,4 +1,34 @@
import 'bootstrap';
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
import axios from 'axios'; import axios from 'axios';
window.axios = axios; window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from 'laravel-echo';
// import Pusher from 'pusher-js';
// window.Pusher = Pusher;
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: import.meta.env.VITE_PUSHER_APP_KEY,
// cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1',
// wsHost: import.meta.env.VITE_PUSHER_HOST ?? `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`,
// wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80,
// wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443,
// forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https',
// enabledTransports: ['ws', 'wss'],
// });
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Laravel + React</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="https://intranet.rencredit.ru/Departments/CS/technical_library/css/normalize-SP.css?v={{ rand(111111, 999999); }}" type="text/css">
<link rel="stylesheet" href="https://intranet.rencredit.ru/Departments/CS/technical_library/css/choices.min.css?v={{ rand(111111, 999999); }}" type="text/css">
<link rel="stylesheet" href="https://intranet.rencredit.ru/Departments/CS/technical_library/css/style.css?v={{ rand(111111, 999999); }}" type="text/css">
<link rel="stylesheet" href="https://intranet.rencredit.ru/Departments/CS/components/css/style.css?v={{ rand(111111, 999999); }}" type="text/css">
<link rel="stylesheet" href="./../css/general.css?v={{ rand(111111, 999999); }}" type="text/css">
<!-- Без команды ниже корректно не обрабатывается React скрипт -->
@viteReactRefresh
<!-- Общие React компоненты для всех страниц -->
@vite(['resources/js/main_script.tsx'])
<!-- Общие React компоненты для всех страниц -->
@vite(['resources/css/main_styles.css'])
@yield('app_styles')
</head>
<body>
<div id=page__header-block data-app_name="{{ $moduleName->getRuModuleName() }}"></div>
<div id=page__content-block>
@yield('app_content')
</div>
@yield('app_scripts')
</body>
</html>
-1
View File
@@ -1,4 +1,3 @@
* *
!private/
!public/ !public/
!.gitignore !.gitignore
+18 -7
View File
@@ -1,18 +1,29 @@
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin'; import laravel from 'laravel-vite-plugin';
import tailwindcss from '@tailwindcss/vite'; import react from '@vitejs/plugin-react'; // Подключите плагин React
import { globbySync } from 'globby'; //Пакет для универсального указания файлов разлиных модулей
// Ищем все JS/CS точки входа во всех модулях
const moduleEntries = globbySync([
'Modules/*/resources/js/app.{jsx,tsx}', // Все app.jsx и app.tsx в подпапках Modules
'Modules/*/resources/css/app.css', // Все app.css
]);
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
laravel({ laravel({
input: ['resources/css/app.css', 'resources/js/app.js'], // Укажите входные точки
input: [
'resources/css/app.css',
'resources/js/app.tsx',
//Благодаря переменной ниже, мы можем не указывать каждый входной jsx и css скрипты для каждого модуля
...moduleEntries,
],
refresh: true, refresh: true,
}), }),
tailwindcss(), react(), // Подключаем плагин React
], ],
server: { esbuild: {
watch: { loader: 'tsx', // Важно для обработки TypeScript
ignored: ['**/storage/framework/views/**'],
},
}, },
}); });