Laravel 11, Vuexy Admin 10.3, by admin@koneko.mx

This commit is contained in:
Arturo Corro 2025-01-25 04:23:40 -06:00
parent c3045b43b1
commit 64d505910f
1283 changed files with 140198 additions and 0 deletions

18
.editorconfig Normal file
View File

@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[docker-compose.yml]
indent_size = 4

52
.env.example Normal file
View File

@ -0,0 +1,52 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=America/Mexico_City
APP_URL=http://localhost
APP_LOCALE=es
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=es_MX
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=sqlite
DB_HOST=
DB_PORT=
DB_DATABASE=
DB_USERNAME=
DB_PASSWORD=
CACHE_STORE=file
SESSION_DRIVER=file
SESSION_CONNECTION=
SESSION_LIFETIME=120
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
MEMCACHED_HOST=127.0.0.1
MEMCACHED_PORT=11211
MEMCACHED_USERNAME=null
MEMCACHED_PASSWORD=null
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
REDIS_DB=
REDIS_CACHE_DB=
REDIS_SESSION_DB=
MAIL_MAILER=smtp
MAIL_SANDBOX=
VITE_APP_NAME="${APP_NAME}"

11
.gitattributes vendored Normal file
View File

@ -0,0 +1,11 @@
* text=auto eol=lf
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore

28
.gitignore vendored Normal file
View File

@ -0,0 +1,28 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.env.production
.phpunit.result.cache
docker-compose.override.yml
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode
!/public/assets
!/public/assets/*
/public/css
/public/js

3
.prettierignore Normal file
View File

@ -0,0 +1,3 @@
dist
node_modules
build

29
.prettierrc.json Normal file
View File

@ -0,0 +1,29 @@
{
"arrowParens": "avoid",
"bracketSpacing": true,
"bracketSameLine": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxSingleQuote": true,
"printWidth": 120,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "none",
"useTabs": false,
"endOfLine": "lf",
"embeddedLanguageFormatting": "auto",
"overrides": [
{
"files": [
"modules/Admin/Resources/assets/vendor/js/*.js"
],
"options": {
"semi": false
}
}
]
}

View File

@ -0,0 +1,8 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
class HomeController extends Controller
{
public function index()
{
return view('pages.home');
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\App;
class LanguageController extends Controller
{
public function swap(Request $request, $locale)
{
if (!in_array($locale, ['en', 'es', 'fr', 'ar', 'de'])) {
abort(400);
} else {
$request->session()->put('locale', $locale);
}
App::setLocale($locale);
return redirect()->back();
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class LocaleMiddleware
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
// Locale is enabled and allowed to be change
if (session()->has('locale') && in_array(session()->get('locale'), ['en', 'es', 'fr', 'ar', 'de'])) {
app()->setLocale(session()->get('locale'));
}
return $next($request);
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Http\Middleware;
use Closure;
use App\Services\WebsiteTemplateService;
use Illuminate\Support\Facades\View;
class WebsiteMiddleware
{
public function __construct()
{
//
}
public function handle($request, Closure $next)
{
// Verificar si estamos en el contexto de Administración
if ($request->is('admin/*')) {
return $next($request);
}
// Compartir variables globalmente solo si es una solicitud HTML
if (str_contains($request->header('Accept'), 'text/html')) {
$webVars = app(WebsiteTemplateService::class)->getWebsiteVars();
View::share('_web', $webVars);
}
return $next($request);
}
}

View File

@ -0,0 +1,272 @@
<?php
namespace App\Services;
use Illuminate\Support\Facades\Cache;
use Modules\Admin\App\Models\Setting;
class WebsiteTemplateService
{
private $cacheTTL = 60 * 24 * 30; // 30 días en minutos
/**
* Actualiza o crea un ajuste en la base de datos.
*/
public function updateSetting(string $key, string $value): bool
{
$setting = Setting::updateOrCreate(
['key' => $key],
['value' => trim($value)]
);
return $setting->save();
}
/**
* Obtiene las variables del sitio web desde el caché o la base de datos.
*/
public function getWebsiteVars(String $setting = ''): array
{
try {
$webVars = Cache::remember('website_settings', $this->cacheTTL, function () {
$settings = Setting::global()
->where(function ($query) {
$query->where('key', 'LIKE', 'website_%')
->orWhere('key', 'LIKE', 'google_%')
->orWhere('key', 'LIKE', 'chat_%');
})
->pluck('value', 'key')
->toArray();
return [
'title' => $settings['website_title'] ?? config('_var.appTitle'),
'author' => config('_var.author'),
'description' => $settings['website_description'] ?? config('_var.appDescription'),
'favicon' => $this->getFaviconPaths($settings),
'app_name' => $settings['website_app_name'] ?? config('_var.appName'),
'image_logo' => $this->getImageLogoPaths($settings),
'template' => $this->getTemplateVars($settings),
'google' => $this->getGoogleVars($settings),
'chat' => $this->getChatVars($settings),
'contact' => $this->getContactVars(),
'social' => $this->getSocialVars(),
];
});
return $setting
? $webVars[$setting]
: $webVars;
} catch (\Exception $e) {
echo __METHOD__;
echo "<br>" . $e->getMessage() . "<br><br>";
die('You must configure the database.');
}
}
/**
* Obtiene los paths de favicon en distintos tamaños.
*/
private function getFaviconPaths(array $settings): array
{
$defaultFavicon = config('_var.appFavicon');
$namespace = $settings['website_favicon_ns'] ?? null;
return [
'namespace' => $namespace,
'16x16' => $namespace ? "{$namespace}_16x16.png" : $defaultFavicon,
'76x76' => $namespace ? "{$namespace}_76x76.png" : $defaultFavicon,
'120x120' => $namespace ? "{$namespace}_120x120.png" : $defaultFavicon,
'152x152' => $namespace ? "{$namespace}_152x152.png" : $defaultFavicon,
'180x180' => $namespace ? "{$namespace}_180x180.png" : $defaultFavicon,
'192x192' => $namespace ? "{$namespace}_192x192.png" : $defaultFavicon,
];
}
/**
* Obtiene los paths de los logos en distintos tamaños.
*/
private function getImageLogoPaths(array $settings): array
{
$defaultLogo = config('_var.appLogo');
return [
'small' => $this->getImagePath($settings, 'website_image_logo_small', $defaultLogo),
'medium' => $this->getImagePath($settings, 'website_image_logo_medium', $defaultLogo),
'large' => $this->getImagePath($settings, 'website_image_logo', $defaultLogo),
'small_dark' => $this->getImagePath($settings, 'website_image_logo_small_dark', $defaultLogo),
'medium_dark' => $this->getImagePath($settings, 'website_image_logo_medium_dark', $defaultLogo),
'large_dark' => $this->getImagePath($settings, 'website_image_logo_dark', $defaultLogo),
];
}
/**
* Obtiene un path de imagen o retorna un valor predeterminado.
*/
private function getImagePath(array $settings, string $key, string $default): string
{
return $settings[$key] ?? $default;
}
/**
* Obtiene las configuraciones de plantilla.
*/
private function getTemplateVars(array $settings): array
{
return [
'style_switcher' => (bool)($settings['website_tpl_style_switcher'] ?? false),
'footer_text' => $settings['website_tpl_footer_text'] ?? '',
];
}
/**
* Obtiene las configuraciones de Google Analytics.
*/
private function getGoogleVars(array $settings): array
{
return [
'analytics' => [
'enabled' => (bool)($settings['google_analytics_enabled'] ?? false),
'id' => $settings['google_analytics_id'] ?? '',
]
];
}
/**
* Obtiene las configuraciones del proveedor de Chat.
*/
private function getChatVars(array $settings): array
{
return [
'provider' => $settings['chat_provider'] ?? '',
'whatsapp_number' => $settings['chat_whatsapp_number'] ?? '',
'whatsapp_message' => $settings['chat_whatsapp_message'] ?? '',
];
}
/**
* Obtiene las variables de contacto.
*/
public function getContactVars(): array
{
$settings = Setting::global()
->where('key', 'LIKE', 'contact_%')
->pluck('value', 'key')
->toArray();
return [
'phone_number' => isset($settings['contact_phone_number'])
? preg_replace('/\D/', '', $settings['contact_phone_number']) // Elimina todo lo que no sea un número
: '',
'phone_number_text' => $settings['contact_phone_number'] ?? '',
'phone_number_ext' => $settings['contact_phone_number_ext'] ?? '',
'email' => $settings['contact_email'] ?? '',
'direccion' => $settings['contact_direccion'] ?? '',
'horario' => $settings['contact_horario'] ?? '',
'location' => [
'lat' => $settings['contact_location_lat'] ?? '',
'lng' => $settings['contact_location_lng'] ?? '',
],
'form' => [
'email' => $settings['contact_form_email'] ?? '',
'email_cc' => $settings['contact_form_email_cc'] ?? '',
'subject' => $settings['contact_form_subject'] ?? '',
],
];
}
/**
* Obtiene las variables de redes sociales.
*/
public function getSocialVars(): array
{
$social = Setting::global()
->where('key', 'LIKE', 'social_%')
->pluck('value', 'key')
->toArray();
return [
'whatsapp' => $social['social_whatsapp'] ?? '',
'whatsapp_message' => $social['social_whatsapp_message'] ?? '',
'facebook' => $social['social_facebook'] ?? '',
'instagram' => $social['social_instagram'] ?? '',
'linkedin' => $social['social_linkedin'] ?? '',
'tiktok' => $social['social_tiktok'] ?? '',
'x_twitter' => $social['social_x_twitter'] ?? '',
'google' => $social['social_google'] ?? '',
'pinterest' => $social['social_pinterest'] ?? '',
'youtube' => $social['social_youtube'] ?? '',
'vimeo' => $social['social_vimeo'] ?? '',
];
}
/**
* Limpia el caché de las variables del sitio web.
*/
public static function clearWebsiteVarsCache(): void
{
Cache::forget('website_settings');
}
/**
* Obtiene las variables legales.
*/
public function getLegalVars($legalDocument = false)
{
$legal = Setting::global()
->where('key', 'LIKE', 'legal_%')
->pluck('value', 'key')
->toArray();
$legalDocuments = [
'legal_terminos_y_condiciones' => [
'title' => 'Términos y condiciones',
'enabled' => (bool)($legal['legal_terminos_y_condiciones_enabled'] ?? false),
'content' => $legal['legal_terminos_y_condiciones_content'] ?? '',
],
'legal_aviso_de_privacidad' => [
'title' => 'Aviso de privacidad',
'enabled' => (bool)($legal['legal_aviso_de_privacidad_enabled'] ?? false),
'content' => $legal['legal_aviso_de_privacidad_content'] ?? '',
],
'legal_politica_de_devoluciones' => [
'title' => 'Política de devoluciones y reembolsos',
'enabled' => (bool)($legal['legal_politica_de_devoluciones_enabled'] ?? false),
'content' => $legal['legal_politica_de_devoluciones_content'] ?? '',
],
'legal_politica_de_envios' => [
'title' => 'Política de envíos',
'enabled' => (bool)($legal['legal_politica_de_envios_enabled'] ?? false),
'content' => $legal['legal_politica_de_envios_content'] ?? '',
],
'legal_politica_de_cookies' => [
'title' => 'Política de cookies',
'enabled' => (bool)($legal['legal_politica_de_cookies_enabled'] ?? false),
'content' => $legal['legal_politica_de_cookies_content'] ?? '',
],
'legal_autorizaciones_y_licencias' => [
'title' => 'Autorizaciones y licencias',
'enabled' => (bool)($legal['legal_autorizaciones_y_licencias_enabled'] ?? false),
'content' => $legal['legal_autorizaciones_y_licencias_content'] ?? '',
],
'legal_informacion_comercial' => [
'title' => 'Información comercial',
'enabled' => (bool)($legal['legal_informacion_comercial_enabled'] ?? false),
'content' => $legal['legal_informacion_comercial_content'] ?? '',
],
'legal_consentimiento_para_el_login_de_terceros' => [
'title' => 'Consentimiento para el login de terceros',
'enabled' => (bool)($legal['legal_consentimiento_para_el_login_de_terceros_enabled'] ?? false),
'content' => $legal['legal_consentimiento_para_el_login_de_terceros_content'] ?? '',
],
'legal_leyendas_de_responsabilidad' => [
'title' => 'Leyendas de responsabilidad',
'enabled' => (bool)($legal['legal_leyendas_de_responsabilidad_enabled'] ?? false),
'content' => $legal['legal_leyendas_de_responsabilidad_content'] ?? '',
],
];
return $legalDocument
? $legalDocuments[$legalDocument]
: $legalDocuments;
}
}

15
artisan Normal file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env php
<?php
use Symfony\Component\Console\Input\ArgvInput;
define('LARAVEL_START', microtime(true));
// Register the Composer autoloader...
require __DIR__.'/vendor/autoload.php';
// Bootstrap Laravel and handle the command...
$status = (require_once __DIR__.'/bootstrap/app.php')
->handleCommand(new ArgvInput);
exit($status);

59
bootstrap/app.php Normal file
View File

@ -0,0 +1,59 @@
<?php
use App\Http\Middleware\LocaleMiddleware;
use App\Http\Middleware\WebsiteMiddleware;
use App\Services\WebsiteTemplateService;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Illuminate\Http\Request;
use Modules\Admin\App\Services\AdminTemplateService;
use \Symfony\Component\HttpKernel\Exception\HttpException;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__ . '/../routes/web.php',
commands: __DIR__ . '/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
$middleware->web(WebsiteMiddleware::class);
$middleware->web(LocaleMiddleware::class);
})
->withExceptions(function (Exceptions $exceptions) {
$exceptions->render(function (HttpException $exception, Request $request) {
// Verificar si estamos en el contexto de admin
$isAdminContext = $request->is(['admin', 'admin/*']);
if ($isAdminContext) {
$pageConfigs = ['myLayout' => 'blank'];
$_admin = app(AdminTemplateService::class)->getAdminVars(); // Obtener las variables del administrador
switch ($exception->getStatusCode()) {
case 400:
return response()->view("admin::errors.400", compact('pageConfigs', 'exception', '_admin'), 400);
case 401:
return response()->view("admin::errors.401", compact('pageConfigs', 'exception', '_admin'), 401);
case 403:
return response()->view("admin::errors.403", compact('pageConfigs', 'exception', '_admin'), 403);
case 404:
return response()->view("admin::errors.404", compact('pageConfigs', 'exception', '_admin'), 404);
}
}
// Si no es el contexto admin, entonces manejar las excepciones normalmente
$_web = app(WebsiteTemplateService::class)->getWebsiteVars(); // Obtener las variables del sitio web
switch ($exception->getStatusCode()) {
case 400:
return response()->view("errors.400", compact('exception', '_web'), 400);
case 401:
return response()->view("errors.401", compact('exception', '_web'), 401);
case 403:
return response()->view("errors.403", compact('exception', '_web'), 403);
case 404:
return response()->view("errors.404", compact('exception', '_web'), 404);
}
});
})
->create();

131
bootstrap/cache/packages.php vendored Executable file
View File

@ -0,0 +1,131 @@
<?php return array (
'barryvdh/laravel-debugbar' =>
array (
'aliases' =>
array (
'Debugbar' => 'Barryvdh\\Debugbar\\Facades\\Debugbar',
),
'providers' =>
array (
0 => 'Barryvdh\\Debugbar\\ServiceProvider',
),
),
'intervention/image-laravel' =>
array (
'aliases' =>
array (
'Image' => 'Intervention\\Image\\Laravel\\Facades\\Image',
),
'providers' =>
array (
0 => 'Intervention\\Image\\Laravel\\ServiceProvider',
),
),
'laravel/fortify' =>
array (
'providers' =>
array (
0 => 'Laravel\\Fortify\\FortifyServiceProvider',
),
),
'laravel/sail' =>
array (
'providers' =>
array (
0 => 'Laravel\\Sail\\SailServiceProvider',
),
),
'laravel/sanctum' =>
array (
'providers' =>
array (
0 => 'Laravel\\Sanctum\\SanctumServiceProvider',
),
),
'laravel/tinker' =>
array (
'providers' =>
array (
0 => 'Laravel\\Tinker\\TinkerServiceProvider',
),
),
'livewire/livewire' =>
array (
'aliases' =>
array (
'Livewire' => 'Livewire\\Livewire',
),
'providers' =>
array (
0 => 'Livewire\\LivewireServiceProvider',
),
),
'maatwebsite/excel' =>
array (
'aliases' =>
array (
'Excel' => 'Maatwebsite\\Excel\\Facades\\Excel',
),
'providers' =>
array (
0 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
),
),
'nesbot/carbon' =>
array (
'providers' =>
array (
0 => 'Carbon\\Laravel\\ServiceProvider',
),
),
'nunomaduro/collision' =>
array (
'providers' =>
array (
0 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
),
),
'nunomaduro/termwind' =>
array (
'providers' =>
array (
0 => 'Termwind\\Laravel\\TermwindServiceProvider',
),
),
'owen-it/laravel-auditing' =>
array (
'providers' =>
array (
0 => 'OwenIt\\Auditing\\AuditingServiceProvider',
),
),
'spatie/laravel-ignition' =>
array (
'aliases' =>
array (
'Flare' => 'Spatie\\LaravelIgnition\\Facades\\Flare',
),
'providers' =>
array (
0 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider',
),
),
'spatie/laravel-permission' =>
array (
'providers' =>
array (
0 => 'Spatie\\Permission\\PermissionServiceProvider',
),
),
'yajra/laravel-datatables-oracle' =>
array (
'aliases' =>
array (
'DataTables' => 'Yajra\\DataTables\\Facades\\DataTables',
),
'providers' =>
array (
0 => 'Yajra\\DataTables\\DataTablesServiceProvider',
),
),
);

274
bootstrap/cache/services.php vendored Executable file
View File

@ -0,0 +1,274 @@
<?php return array (
'providers' =>
array (
0 => 'Illuminate\\Auth\\AuthServiceProvider',
1 => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
2 => 'Illuminate\\Bus\\BusServiceProvider',
3 => 'Illuminate\\Cache\\CacheServiceProvider',
4 => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
5 => 'Illuminate\\Concurrency\\ConcurrencyServiceProvider',
6 => 'Illuminate\\Cookie\\CookieServiceProvider',
7 => 'Illuminate\\Database\\DatabaseServiceProvider',
8 => 'Illuminate\\Encryption\\EncryptionServiceProvider',
9 => 'Illuminate\\Filesystem\\FilesystemServiceProvider',
10 => 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider',
11 => 'Illuminate\\Hashing\\HashServiceProvider',
12 => 'Illuminate\\Mail\\MailServiceProvider',
13 => 'Illuminate\\Notifications\\NotificationServiceProvider',
14 => 'Illuminate\\Pagination\\PaginationServiceProvider',
15 => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
16 => 'Illuminate\\Pipeline\\PipelineServiceProvider',
17 => 'Illuminate\\Queue\\QueueServiceProvider',
18 => 'Illuminate\\Redis\\RedisServiceProvider',
19 => 'Illuminate\\Session\\SessionServiceProvider',
20 => 'Illuminate\\Translation\\TranslationServiceProvider',
21 => 'Illuminate\\Validation\\ValidationServiceProvider',
22 => 'Illuminate\\View\\ViewServiceProvider',
23 => 'Barryvdh\\Debugbar\\ServiceProvider',
24 => 'Intervention\\Image\\Laravel\\ServiceProvider',
25 => 'Laravel\\Fortify\\FortifyServiceProvider',
26 => 'Laravel\\Sail\\SailServiceProvider',
27 => 'Laravel\\Sanctum\\SanctumServiceProvider',
28 => 'Laravel\\Tinker\\TinkerServiceProvider',
29 => 'Livewire\\LivewireServiceProvider',
30 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
31 => 'Carbon\\Laravel\\ServiceProvider',
32 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
33 => 'Termwind\\Laravel\\TermwindServiceProvider',
34 => 'OwenIt\\Auditing\\AuditingServiceProvider',
35 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider',
36 => 'Spatie\\Permission\\PermissionServiceProvider',
37 => 'Yajra\\DataTables\\DataTablesServiceProvider',
38 => 'Modules\\Admin\\ModuleServiceProvider',
),
'eager' =>
array (
0 => 'Illuminate\\Auth\\AuthServiceProvider',
1 => 'Illuminate\\Cookie\\CookieServiceProvider',
2 => 'Illuminate\\Database\\DatabaseServiceProvider',
3 => 'Illuminate\\Encryption\\EncryptionServiceProvider',
4 => 'Illuminate\\Filesystem\\FilesystemServiceProvider',
5 => 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider',
6 => 'Illuminate\\Notifications\\NotificationServiceProvider',
7 => 'Illuminate\\Pagination\\PaginationServiceProvider',
8 => 'Illuminate\\Session\\SessionServiceProvider',
9 => 'Illuminate\\View\\ViewServiceProvider',
10 => 'Barryvdh\\Debugbar\\ServiceProvider',
11 => 'Intervention\\Image\\Laravel\\ServiceProvider',
12 => 'Laravel\\Fortify\\FortifyServiceProvider',
13 => 'Laravel\\Sanctum\\SanctumServiceProvider',
14 => 'Livewire\\LivewireServiceProvider',
15 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
16 => 'Carbon\\Laravel\\ServiceProvider',
17 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
18 => 'Termwind\\Laravel\\TermwindServiceProvider',
19 => 'OwenIt\\Auditing\\AuditingServiceProvider',
20 => 'Spatie\\LaravelIgnition\\IgnitionServiceProvider',
21 => 'Spatie\\Permission\\PermissionServiceProvider',
22 => 'Yajra\\DataTables\\DataTablesServiceProvider',
23 => 'Modules\\Admin\\ModuleServiceProvider',
),
'deferred' =>
array (
'Illuminate\\Broadcasting\\BroadcastManager' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
'Illuminate\\Contracts\\Broadcasting\\Factory' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
'Illuminate\\Contracts\\Broadcasting\\Broadcaster' => 'Illuminate\\Broadcasting\\BroadcastServiceProvider',
'Illuminate\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
'Illuminate\\Contracts\\Bus\\Dispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
'Illuminate\\Contracts\\Bus\\QueueingDispatcher' => 'Illuminate\\Bus\\BusServiceProvider',
'Illuminate\\Bus\\BatchRepository' => 'Illuminate\\Bus\\BusServiceProvider',
'Illuminate\\Bus\\DatabaseBatchRepository' => 'Illuminate\\Bus\\BusServiceProvider',
'cache' => 'Illuminate\\Cache\\CacheServiceProvider',
'cache.store' => 'Illuminate\\Cache\\CacheServiceProvider',
'cache.psr6' => 'Illuminate\\Cache\\CacheServiceProvider',
'memcached.connector' => 'Illuminate\\Cache\\CacheServiceProvider',
'Illuminate\\Cache\\RateLimiter' => 'Illuminate\\Cache\\CacheServiceProvider',
'Illuminate\\Foundation\\Console\\AboutCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Cache\\Console\\ClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Cache\\Console\\ForgetCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ClearCompiledCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Auth\\Console\\ClearResetsCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ConfigCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ConfigClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ConfigShowCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\DbCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\MonitorCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\PruneCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\ShowCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\TableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\WipeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\DownCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EnvironmentCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EnvironmentDecryptCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EnvironmentEncryptCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EventCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EventClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EventListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Concurrency\\Console\\InvokeSerializedClosureCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\KeyGenerateCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\OptimizeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\OptimizeClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\PackageDiscoverCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Cache\\Console\\PruneStaleTagsCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\ClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\ListFailedCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\FlushFailedCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\ForgetFailedCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\ListenCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\MonitorCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\PruneBatchesCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\PruneFailedJobsCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\RestartCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\RetryCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\RetryBatchCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\WorkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\RouteCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\RouteClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\RouteListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\DumpCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Seeds\\SeedCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleFinishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleRunCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleClearCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleTestCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleWorkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleInterruptCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\ShowModelCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\StorageLinkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\StorageUnlinkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\UpCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ViewCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ViewClearCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ApiInstallCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\BroadcastingInstallCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Cache\\Console\\CacheTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\CastMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ChannelListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ChannelMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ClassMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ComponentMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ConfigPublishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ConsoleMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Routing\\Console\\ControllerMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\DocsCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EnumMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EventGenerateCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EventMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ExceptionMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Factories\\FactoryMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\InterfaceMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\JobMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\JobMiddlewareMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\LangPublishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ListenerMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\MailMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Routing\\Console\\MiddlewareMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ModelMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\NotificationMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Notifications\\Console\\NotificationTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ObserverMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\PolicyMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ProviderMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\FailedTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\TableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Queue\\Console\\BatchesTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\RequestMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ResourceMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\RuleMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ScopeMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Seeds\\SeederMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Session\\Console\\SessionTableCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ServeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\StubPublishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\TestMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\TraitMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\VendorPublishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ViewMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'migrator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'migration.repository' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'migration.creator' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\MigrateCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\FreshCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\InstallCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\RefreshCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\ResetCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\RollbackCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\StatusCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\MigrateMakeCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'composer' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Concurrency\\ConcurrencyManager' => 'Illuminate\\Concurrency\\ConcurrencyServiceProvider',
'hash' => 'Illuminate\\Hashing\\HashServiceProvider',
'hash.driver' => 'Illuminate\\Hashing\\HashServiceProvider',
'mail.manager' => 'Illuminate\\Mail\\MailServiceProvider',
'mailer' => 'Illuminate\\Mail\\MailServiceProvider',
'Illuminate\\Mail\\Markdown' => 'Illuminate\\Mail\\MailServiceProvider',
'auth.password' => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
'auth.password.broker' => 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider',
'Illuminate\\Contracts\\Pipeline\\Hub' => 'Illuminate\\Pipeline\\PipelineServiceProvider',
'pipeline' => 'Illuminate\\Pipeline\\PipelineServiceProvider',
'queue' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.connection' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.failer' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.listener' => 'Illuminate\\Queue\\QueueServiceProvider',
'queue.worker' => 'Illuminate\\Queue\\QueueServiceProvider',
'redis' => 'Illuminate\\Redis\\RedisServiceProvider',
'redis.connection' => 'Illuminate\\Redis\\RedisServiceProvider',
'translator' => 'Illuminate\\Translation\\TranslationServiceProvider',
'translation.loader' => 'Illuminate\\Translation\\TranslationServiceProvider',
'validator' => 'Illuminate\\Validation\\ValidationServiceProvider',
'validation.presence' => 'Illuminate\\Validation\\ValidationServiceProvider',
'Illuminate\\Contracts\\Validation\\UncompromisedVerifier' => 'Illuminate\\Validation\\ValidationServiceProvider',
'Laravel\\Sail\\Console\\InstallCommand' => 'Laravel\\Sail\\SailServiceProvider',
'Laravel\\Sail\\Console\\PublishCommand' => 'Laravel\\Sail\\SailServiceProvider',
'command.tinker' => 'Laravel\\Tinker\\TinkerServiceProvider',
),
'when' =>
array (
'Illuminate\\Broadcasting\\BroadcastServiceProvider' =>
array (
),
'Illuminate\\Bus\\BusServiceProvider' =>
array (
),
'Illuminate\\Cache\\CacheServiceProvider' =>
array (
),
'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider' =>
array (
),
'Illuminate\\Concurrency\\ConcurrencyServiceProvider' =>
array (
),
'Illuminate\\Hashing\\HashServiceProvider' =>
array (
),
'Illuminate\\Mail\\MailServiceProvider' =>
array (
),
'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider' =>
array (
),
'Illuminate\\Pipeline\\PipelineServiceProvider' =>
array (
),
'Illuminate\\Queue\\QueueServiceProvider' =>
array (
),
'Illuminate\\Redis\\RedisServiceProvider' =>
array (
),
'Illuminate\\Translation\\TranslationServiceProvider' =>
array (
),
'Illuminate\\Validation\\ValidationServiceProvider' =>
array (
),
'Laravel\\Sail\\SailServiceProvider' =>
array (
),
'Laravel\\Tinker\\TinkerServiceProvider' =>
array (
),
),
);

6
bootstrap/providers.php Normal file
View File

@ -0,0 +1,6 @@
<?php
return [
//App\Providers\WebTemplateProvider::class,
Modules\Admin\ModuleServiceProvider::class,
];

82
composer.json Normal file
View File

@ -0,0 +1,82 @@
{
"name": "koneko/laravel-vuexy-admin",
"type": "project",
"description": "Laravel Vuexy Admin para México. Un proyecto optimizado para mexicano.",
"keywords": [
"laravel",
"framework",
"vuexy",
"admin"
],
"license": "MIT",
"require": {
"php": "^8.2",
"intervention/image-laravel": "^1.3",
"laravel/fortify": "^1.25",
"laravel/framework": "^11.0",
"laravel/sanctum": "^4.0",
"laravel/tinker": "^2.9",
"livewire/livewire": "^3.5",
"maatwebsite/excel": "^3.1",
"owen-it/laravel-auditing": "^13.6",
"spatie/laravel-permission": "^6.10",
"yajra/laravel-datatables-oracle": "^11.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.14",
"fakerphp/faker": "^1.23",
"laravel/pint": "^1.13",
"laravel/sail": "^1.26",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.0",
"phpunit/phpunit": "^11.0",
"spatie/laravel-ignition": "^2.4"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Modules\\": "modules/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
},
"files": [
"modules/Admin/App/Helpers/Helpers.php"
]
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

9968
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

128
config/app.php Normal file
View File

@ -0,0 +1,128 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application, which will be used when the
| framework needs to place the application's name in a notification or
| other UI elements where an application name needs to be displayed.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| 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 application so that it's available within Artisan commands.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. The timezone
| is set to "UTC" by default as it is suitable for most use cases.
|
*/
'timezone' => env('APP_TIMEZONE', 'UTC'),
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by Laravel's translation / localization methods. This option can be
| set to any locale for which you plan to have translation strings.
|
*/
'locale' => env('APP_LOCALE', 'en'),
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is utilized by Laravel's encryption services and should be set
| to a random, 32 character string to ensure that all encrypted values
| are secure. You should do this prior to deploying the application.
|
*/
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', env('APP_PREVIOUS_KEYS', ''))
),
],
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],
'aliases' => [],
];

198
config/audit.php Normal file
View File

@ -0,0 +1,198 @@
<?php
return [
'enabled' => env('AUDITING_ENABLED', true),
/*
|--------------------------------------------------------------------------
| Audit Implementation
|--------------------------------------------------------------------------
|
| Define which Audit model implementation should be used.
|
*/
'implementation' => OwenIt\Auditing\Models\Audit::class,
/*
|--------------------------------------------------------------------------
| User Morph prefix & Guards
|--------------------------------------------------------------------------
|
| Define the morph prefix and authentication guards for the User resolver.
|
*/
'user' => [
'morph_prefix' => 'user',
'guards' => [
'web',
'api'
],
'resolver' => OwenIt\Auditing\Resolvers\UserResolver::class
],
/*
|--------------------------------------------------------------------------
| Audit Resolvers
|--------------------------------------------------------------------------
|
| Define the IP Address, User Agent and URL resolver implementations.
|
*/
'resolvers' => [
'ip_address' => OwenIt\Auditing\Resolvers\IpAddressResolver::class,
'user_agent' => OwenIt\Auditing\Resolvers\UserAgentResolver::class,
'url' => OwenIt\Auditing\Resolvers\UrlResolver::class,
],
/*
|--------------------------------------------------------------------------
| Audit Events
|--------------------------------------------------------------------------
|
| The Eloquent events that trigger an Audit.
|
*/
'events' => [
'created',
'updated',
'deleted',
'restored'
],
/*
|--------------------------------------------------------------------------
| Strict Mode
|--------------------------------------------------------------------------
|
| Enable the strict mode when auditing?
|
*/
'strict' => false,
/*
|--------------------------------------------------------------------------
| Global exclude
|--------------------------------------------------------------------------
|
| Have something you always want to exclude by default? - add it here.
| Note that this is overwritten (not merged) with local exclude
|
*/
'exclude' => [],
/*
|--------------------------------------------------------------------------
| Empty Values
|--------------------------------------------------------------------------
|
| Should Audit records be stored when the recorded old_values & new_values
| are both empty?
|
| Some events may be empty on purpose. Use allowed_empty_values to exclude
| those from the empty values check. For example when auditing
| model retrieved events which will never have new and old values.
|
|
*/
'empty_values' => true,
'allowed_empty_values' => [
'retrieved'
],
/*
|--------------------------------------------------------------------------
| Allowed Array Values
|--------------------------------------------------------------------------
|
| Should the array values be audited?
|
| By default, array values are not allowed. This is to prevent performance
| issues when storing large amounts of data. You can override this by
| setting allow_array_values to true.
*/
'allowed_array_values' => false,
/*
|--------------------------------------------------------------------------
| Audit Timestamps
|--------------------------------------------------------------------------
|
| Should the created_at, updated_at and deleted_at timestamps be audited?
|
*/
'timestamps' => false,
/*
|--------------------------------------------------------------------------
| Audit Threshold
|--------------------------------------------------------------------------
|
| Specify a threshold for the amount of Audit records a model can have.
| Zero means no limit.
|
*/
'threshold' => 0,
/*
|--------------------------------------------------------------------------
| Audit Driver
|--------------------------------------------------------------------------
|
| The default audit driver used to keep track of changes.
|
*/
'driver' => 'database',
/*
|--------------------------------------------------------------------------
| Audit Driver Configurations
|--------------------------------------------------------------------------
|
| Available audit drivers and respective configurations.
|
*/
'drivers' => [
'database' => [
'table' => 'audits',
'connection' => null,
],
],
/*
|--------------------------------------------------------------------------
| Audit Queue Configurations
|--------------------------------------------------------------------------
|
| Available audit queue configurations.
|
*/
'queue' => [
'enable' => false,
'connection' => 'sync',
'queue' => 'default',
'delay' => 0,
],
/*
|--------------------------------------------------------------------------
| Audit Console
|--------------------------------------------------------------------------
|
| Whether console events should be audited (eg. php artisan db:seed).
|
*/
'console' => false,
];

115
config/auth.php Normal file
View File

@ -0,0 +1,115 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option defines the default authentication "guard" and password
| reset "broker" for your application. You may change these values
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => env('AUTH_GUARD', 'web'),
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| which utilizes session storage plus the Eloquent user provider.
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| If you have multiple user tables or models you may configure multiple
| providers to represent the model / table. These providers may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', Modules\Admin\App\Models\User::class),
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| These configuration options specify the behavior of Laravel's password
| reset functionality, including the table utilized for token storage
| and the user provider that is invoked to actually retrieve users.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| window expires and users are asked to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];

107
config/cache.php Normal file
View File

@ -0,0 +1,107 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache store that will be used by the
| framework. This connection is utilized if another isn't explicitly
| specified when running a cache operation inside the application.
|
*/
'default' => env('CACHE_STORE', 'database'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file", "memcached",
| "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'table' => env('DB_CACHE_TABLE', 'cache'),
'connection' => env('DB_CACHE_CONNECTION', null),
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION', null),
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
| stores, there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache_'),
];

179
config/database.php Normal file
View File

@ -0,0 +1,179 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for database operations. This is
| the connection which will be utilized unless another connection
| is explicitly specified when you execute a query / statement.
|
*/
'default' => env('DB_CONNECTION', 'sqlite'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Below are all of the database connections defined for your application.
| An example configuration is provided for each database system which
| is supported by Laravel. You're free to add / remove connections.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run on the database.
|
*/
'migrations' => [
'table' => 'migrations',
'update_date_on_publish' => true,
],
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as Memcached. You may define your connection settings here.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
'sessions' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_SESSION_DB', '2'), // Base de datos específica para sesiones
],
],
];

127
config/datatables.php Normal file
View File

@ -0,0 +1,127 @@
<?php
return [
/*
* DataTables search options.
*/
'search' => [
/*
* Smart search will enclose search keyword with wildcard string "%keyword%".
* SQL: column LIKE "%keyword%"
*/
'smart' => true,
/*
* Multi-term search will explode search keyword using spaces resulting into multiple term search.
*/
'multi_term' => true,
/*
* Case insensitive will search the keyword in lower case format.
* SQL: LOWER(column) LIKE LOWER(keyword)
*/
'case_insensitive' => true,
/*
* Wild card will add "%" in between every characters of the keyword.
* SQL: column LIKE "%k%e%y%w%o%r%d%"
*/
'use_wildcards' => false,
/*
* Perform a search which starts with the given keyword.
* SQL: column LIKE "keyword%"
*/
'starts_with' => false,
],
/*
* DataTables internal index id response column name.
*/
'index_column' => 'DT_RowIndex',
/*
* List of available builders for DataTables.
* This is where you can register your custom dataTables builder.
*/
'engines' => [
'eloquent' => Yajra\DataTables\EloquentDataTable::class,
'query' => Yajra\DataTables\QueryDataTable::class,
'collection' => Yajra\DataTables\CollectionDataTable::class,
'resource' => Yajra\DataTables\ApiResourceDataTable::class,
],
/*
* DataTables accepted builder to engine mapping.
* This is where you can override which engine a builder should use
* Note, only change this if you know what you are doing!
*/
'builders' => [
//Illuminate\Database\Eloquent\Relations\Relation::class => 'eloquent',
//Illuminate\Database\Eloquent\Builder::class => 'eloquent',
//Illuminate\Database\Query\Builder::class => 'query',
//Illuminate\Support\Collection::class => 'collection',
],
/*
* Nulls last sql pattern for PostgreSQL & Oracle.
* For MySQL, use 'CASE WHEN :column IS NULL THEN 1 ELSE 0 END, :column :direction'
*/
'nulls_last_sql' => ':column :direction NULLS LAST',
/*
* User friendly message to be displayed on user if error occurs.
* Possible values:
* null - The exception message will be used on error response.
* 'throw' - Throws a \Yajra\DataTables\Exceptions\Exception. Use your custom error handler if needed.
* 'custom message' - Any friendly message to be displayed to the user. You can also use translation key.
*/
'error' => env('DATATABLES_ERROR', null),
/*
* Default columns definition of dataTable utility functions.
*/
'columns' => [
/*
* List of columns hidden/removed on json response.
*/
'excess' => ['rn', 'row_num'],
/*
* List of columns to be escaped. If set to *, all columns are escape.
* Note: You can set the value to empty array to disable XSS protection.
*/
'escape' => '*',
/*
* List of columns that are allowed to display html content.
* Note: Adding columns to list will make us available to XSS attacks.
*/
'raw' => ['action'],
/*
* List of columns are forbidden from being searched/sorted.
*/
'blacklist' => ['password', 'remember_token'],
/*
* List of columns that are only allowed fo search/sort.
* If set to *, all columns are allowed.
*/
'whitelist' => '*',
],
/*
* JsonResponse header and options config.
*/
'json' => [
'header' => [],
'options' => 0,
],
/*
* Default condition to determine if a parameter is a callback or not.
* Callbacks needs to start by those terms, or they will be cast to string.
*/
'callback' => ['$', '$.', 'function'],
];

380
config/excel.php Normal file
View File

@ -0,0 +1,380 @@
<?php
use Maatwebsite\Excel\Excel;
use PhpOffice\PhpSpreadsheet\Reader\Csv;
return [
'exports' => [
/*
|--------------------------------------------------------------------------
| Chunk size
|--------------------------------------------------------------------------
|
| When using FromQuery, the query is automatically chunked.
| Here you can specify how big the chunk should be.
|
*/
'chunk_size' => 1000,
/*
|--------------------------------------------------------------------------
| Pre-calculate formulas during export
|--------------------------------------------------------------------------
*/
'pre_calculate_formulas' => false,
/*
|--------------------------------------------------------------------------
| Enable strict null comparison
|--------------------------------------------------------------------------
|
| When enabling strict null comparison empty cells ('') will
| be added to the sheet.
*/
'strict_null_comparison' => false,
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV exports.
|
*/
'csv' => [
'delimiter' => ',',
'enclosure' => '"',
'line_ending' => PHP_EOL,
'use_bom' => false,
'include_separator_line' => false,
'excel_compatibility' => false,
'output_encoding' => '',
'test_auto_detect' => true,
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
],
'imports' => [
/*
|--------------------------------------------------------------------------
| Read Only
|--------------------------------------------------------------------------
|
| When dealing with imports, you might only be interested in the
| data that the sheet exists. By default we ignore all styles,
| however if you want to do some logic based on style data
| you can enable it by setting read_only to false.
|
*/
'read_only' => true,
/*
|--------------------------------------------------------------------------
| Ignore Empty
|--------------------------------------------------------------------------
|
| When dealing with imports, you might be interested in ignoring
| rows that have null values or empty strings. By default rows
| containing empty strings or empty values are not ignored but can be
| ignored by enabling the setting ignore_empty to true.
|
*/
'ignore_empty' => false,
/*
|--------------------------------------------------------------------------
| Heading Row Formatter
|--------------------------------------------------------------------------
|
| Configure the heading row formatter.
| Available options: none|slug|custom
|
*/
'heading_row' => [
'formatter' => 'slug',
],
/*
|--------------------------------------------------------------------------
| CSV Settings
|--------------------------------------------------------------------------
|
| Configure e.g. delimiter, enclosure and line ending for CSV imports.
|
*/
'csv' => [
'delimiter' => null,
'enclosure' => '"',
'escape_character' => '\\',
'contiguous' => false,
'input_encoding' => Csv::GUESS_ENCODING,
],
/*
|--------------------------------------------------------------------------
| Worksheet properties
|--------------------------------------------------------------------------
|
| Configure e.g. default title, creator, subject,...
|
*/
'properties' => [
'creator' => '',
'lastModifiedBy' => '',
'title' => '',
'description' => '',
'subject' => '',
'keywords' => '',
'category' => '',
'manager' => '',
'company' => '',
],
/*
|--------------------------------------------------------------------------
| Cell Middleware
|--------------------------------------------------------------------------
|
| Configure middleware that is executed on getting a cell value
|
*/
'cells' => [
'middleware' => [
//\Maatwebsite\Excel\Middleware\TrimCellValue::class,
//\Maatwebsite\Excel\Middleware\ConvertEmptyCellValuesToNull::class,
],
],
],
/*
|--------------------------------------------------------------------------
| Extension detector
|--------------------------------------------------------------------------
|
| Configure here which writer/reader type should be used when the package
| needs to guess the correct type based on the extension alone.
|
*/
'extension_detector' => [
'xlsx' => Excel::XLSX,
'xlsm' => Excel::XLSX,
'xltx' => Excel::XLSX,
'xltm' => Excel::XLSX,
'xls' => Excel::XLS,
'xlt' => Excel::XLS,
'ods' => Excel::ODS,
'ots' => Excel::ODS,
'slk' => Excel::SLK,
'xml' => Excel::XML,
'gnumeric' => Excel::GNUMERIC,
'htm' => Excel::HTML,
'html' => Excel::HTML,
'csv' => Excel::CSV,
'tsv' => Excel::TSV,
/*
|--------------------------------------------------------------------------
| PDF Extension
|--------------------------------------------------------------------------
|
| Configure here which Pdf driver should be used by default.
| Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF
|
*/
'pdf' => Excel::DOMPDF,
],
/*
|--------------------------------------------------------------------------
| Value Binder
|--------------------------------------------------------------------------
|
| PhpSpreadsheet offers a way to hook into the process of a value being
| written to a cell. In there some assumptions are made on how the
| value should be formatted. If you want to change those defaults,
| you can implement your own default value binder.
|
| Possible value binders:
|
| [x] Maatwebsite\Excel\DefaultValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\StringValueBinder::class
| [x] PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class
|
*/
'value_binder' => [
'default' => Maatwebsite\Excel\DefaultValueBinder::class,
],
'cache' => [
/*
|--------------------------------------------------------------------------
| Default cell caching driver
|--------------------------------------------------------------------------
|
| By default PhpSpreadsheet keeps all cell values in memory, however when
| dealing with large files, this might result into memory issues. If you
| want to mitigate that, you can configure a cell caching driver here.
| When using the illuminate driver, it will store each value in the
| cache store. This can slow down the process, because it needs to
| store each value. You can use the "batch" store if you want to
| only persist to the store when the memory limit is reached.
|
| Drivers: memory|illuminate|batch
|
*/
'driver' => 'memory',
/*
|--------------------------------------------------------------------------
| Batch memory caching
|--------------------------------------------------------------------------
|
| When dealing with the "batch" caching driver, it will only
| persist to the store when the memory limit is reached.
| Here you can tweak the memory limit to your liking.
|
*/
'batch' => [
'memory_limit' => 60000,
],
/*
|--------------------------------------------------------------------------
| Illuminate cache
|--------------------------------------------------------------------------
|
| When using the "illuminate" caching driver, it will automatically use
| your default cache store. However if you prefer to have the cell
| cache on a separate store, you can configure the store name here.
| You can use any store defined in your cache config. When leaving
| at "null" it will use the default store.
|
*/
'illuminate' => [
'store' => null,
],
/*
|--------------------------------------------------------------------------
| Cache Time-to-live (TTL)
|--------------------------------------------------------------------------
|
| The TTL of items written to cache. If you want to keep the items cached
| indefinitely, set this to null. Otherwise, set a number of seconds,
| a \DateInterval, or a callable.
|
| Allowable types: callable|\DateInterval|int|null
|
*/
'default_ttl' => 10800,
],
/*
|--------------------------------------------------------------------------
| Transaction Handler
|--------------------------------------------------------------------------
|
| By default the import is wrapped in a transaction. This is useful
| for when an import may fail and you want to retry it. With the
| transactions, the previous import gets rolled-back.
|
| You can disable the transaction handler by setting this to null.
| Or you can choose a custom made transaction handler here.
|
| Supported handlers: null|db
|
*/
'transactions' => [
'handler' => 'db',
'db' => [
'connection' => null,
],
],
'temporary_files' => [
/*
|--------------------------------------------------------------------------
| Local Temporary Path
|--------------------------------------------------------------------------
|
| When exporting and importing files, we use a temporary file, before
| storing reading or downloading. Here you can customize that path.
| permissions is an array with the permission flags for the directory (dir)
| and the create file (file).
|
*/
'local_path' => storage_path('framework/cache/laravel-excel'),
/*
|--------------------------------------------------------------------------
| Local Temporary Path Permissions
|--------------------------------------------------------------------------
|
| Permissions is an array with the permission flags for the directory (dir)
| and the create file (file).
| If omitted the default permissions of the filesystem will be used.
|
*/
'local_permissions' => [
// 'dir' => 0755,
// 'file' => 0644,
],
/*
|--------------------------------------------------------------------------
| Remote Temporary Disk
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup with queues in which you
| cannot rely on having a shared local temporary path, you might
| want to store the temporary file on a shared disk. During the
| queue executing, we'll retrieve the temporary file from that
| location instead. When left to null, it will always use
| the local path. This setting only has effect when using
| in conjunction with queued imports and exports.
|
*/
'remote_disk' => null,
'remote_prefix' => null,
/*
|--------------------------------------------------------------------------
| Force Resync
|--------------------------------------------------------------------------
|
| When dealing with a multi server setup as above, it's possible
| for the clean up that occurs after entire queue has been run to only
| cleanup the server that the last AfterImportJob runs on. The rest of the server
| would still have the local temporary file stored on it. In this case your
| local storage limits can be exceeded and future imports won't be processed.
| To mitigate this you can set this config value to be true, so that after every
| queued chunk is processed the local temporary file is deleted on the server that
| processed it.
|
*/
'force_resync_remote' => null,
],
];

76
config/filesystems.php Normal file
View File

@ -0,0 +1,76 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application for file storage.
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Below you may configure as many filesystem disks as necessary, and you
| may even configure multiple disks for the same driver. Examples for
| most supported storage drivers are configured here for reference.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'throw' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
'throw' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

159
config/fortify.php Normal file
View File

@ -0,0 +1,159 @@
<?php
use Laravel\Fortify\Features;
return [
/*
|--------------------------------------------------------------------------
| Fortify Guard
|--------------------------------------------------------------------------
|
| Here you may specify which authentication guard Fortify will use while
| authenticating users. This value should correspond with one of your
| guards that is already present in your "auth" configuration file.
|
*/
'guard' => 'web',
/*
|--------------------------------------------------------------------------
| Fortify Password Broker
|--------------------------------------------------------------------------
|
| Here you may specify which password broker Fortify can use when a user
| is resetting their password. This configured value should match one
| of your password brokers setup in your "auth" configuration file.
|
*/
'passwords' => 'users',
/*
|--------------------------------------------------------------------------
| Username / Email
|--------------------------------------------------------------------------
|
| This value defines which model attribute should be considered as your
| application's "username" field. Typically, this might be the email
| address of the users but you are free to change this value here.
|
| Out of the box, Fortify expects forgot password and reset password
| requests to have a field named 'email'. If the application uses
| another name for the field you may define it below as needed.
|
*/
'username' => 'email',
'email' => 'email',
/*
|--------------------------------------------------------------------------
| Lowercase Usernames
|--------------------------------------------------------------------------
|
| This value defines whether usernames should be lowercased before saving
| them in the database, as some database system string fields are case
| sensitive. You may disable this for your application if necessary.
|
*/
'lowercase_usernames' => true,
/*
|--------------------------------------------------------------------------
| Home Path
|--------------------------------------------------------------------------
|
| Here you may configure the path where users will get redirected during
| authentication or password reset when the operations are successful
| and the user is authenticated. You are free to change this value.
|
*/
'home' => '/',
/*
|--------------------------------------------------------------------------
| Fortify Routes Prefix / Subdomain
|--------------------------------------------------------------------------
|
| Here you may specify which prefix Fortify will assign to all the routes
| that it registers with the application. If necessary, you may change
| subdomain under which all of the Fortify routes will be available.
|
*/
'prefix' => '',
'domain' => null,
/*
|--------------------------------------------------------------------------
| Fortify Routes Middleware
|--------------------------------------------------------------------------
|
| Here you may specify which middleware Fortify will assign to the routes
| that it registers with the application. If necessary, you may change
| these middleware but typically this provided default is preferred.
|
*/
'middleware' => ['web'],
/*
|--------------------------------------------------------------------------
| Rate Limiting
|--------------------------------------------------------------------------
|
| By default, Fortify will throttle logins to five requests per minute for
| every email and IP address combination. However, if you would like to
| specify a custom rate limiter to call then you may specify it here.
|
*/
'limiters' => [
'login' => 'login',
'two-factor' => 'two-factor',
],
/*
|--------------------------------------------------------------------------
| Register View Routes
|--------------------------------------------------------------------------
|
| Here you may specify if the routes returning views should be disabled as
| you may not need them when building your own application. This may be
| especially true if you're writing a custom single-page application.
|
*/
'views' => true,
/*
|--------------------------------------------------------------------------
| Features
|--------------------------------------------------------------------------
|
| Some of the Fortify features are optional. You may disable the features
| by removing them from this array. You're free to only remove some of
| these features or you can even remove all of these if you need to.
|
*/
'features' => [
Features::registration(),
Features::resetPasswords(),
Features::emailVerification(),
Features::updateProfileInformation(),
Features::updatePasswords(),
Features::twoFactorAuthentication([
'confirm' => true,
'confirmPassword' => true,
'window' => 1,
]),
],
];

42
config/image.php Normal file
View File

@ -0,0 +1,42 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Image Driver
|--------------------------------------------------------------------------
|
| Intervention Image supports “GD Library” and “Imagick” to process images
| internally. Depending on your PHP setup, you can choose one of them.
|
| Included options:
| - \Intervention\Image\Drivers\Gd\Driver::class
| - \Intervention\Image\Drivers\Imagick\Driver::class
|
*/
'driver' => \Intervention\Image\Drivers\Imagick\Driver::class,
/*
|--------------------------------------------------------------------------
| Configuration Options
|--------------------------------------------------------------------------
|
| These options control the behavior of Intervention Image.
|
| - "autoOrientation" controls whether an imported image should be
| automatically rotated according to any existing Exif data.
|
| - "decodeAnimation" decides whether a possibly animated image is
| decoded as such or whether the animation is discarded.
|
| - "blendingColor" Defines the default blending color.
*/
'options' => [
'autoOrientation' => true,
'decodeAnimation' => true,
'blendingColor' => 'ffffff',
]
];

160
config/livewire.php Normal file
View File

@ -0,0 +1,160 @@
<?php
return [
/*
|---------------------------------------------------------------------------
| Class Namespace
|---------------------------------------------------------------------------
|
| This value sets the root class namespace for Livewire component classes in
| your application. This value will change where component auto-discovery
| finds components. It's also referenced by the file creation commands.
|
*/
'class_namespace' => 'App\\Livewire',
/*
|---------------------------------------------------------------------------
| View Path
|---------------------------------------------------------------------------
|
| This value is used to specify where Livewire component Blade templates are
| stored when running file creation commands like `artisan make:livewire`.
| It is also used if you choose to omit a component's render() method.
|
*/
'view_path' => resource_path('views/livewire'),
/*
|---------------------------------------------------------------------------
| Layout
|---------------------------------------------------------------------------
| The view that will be used as the layout when rendering a single component
| as an entire page via `Route::get('/post/create', CreatePost::class);`.
| In this case, the view returned by CreatePost will render into $slot.
|
*/
'layout' => 'components.layouts.app',
/*
|---------------------------------------------------------------------------
| Lazy Loading Placeholder
|---------------------------------------------------------------------------
| Livewire allows you to lazy load components that would otherwise slow down
| the initial page load. Every component can have a custom placeholder or
| you can define the default placeholder view for all components below.
|
*/
'lazy_placeholder' => null,
/*
|---------------------------------------------------------------------------
| Temporary File Uploads
|---------------------------------------------------------------------------
|
| Livewire handles file uploads by storing uploads in a temporary directory
| before the file is stored permanently. All file uploads are directed to
| a global endpoint for temporary storage. You may configure this below:
|
*/
'temporary_file_upload' => [
'disk' => null, // Example: 'local', 's3' | Default: 'default'
'rules' => null, // Example: ['file', 'mimes:png,jpg'] | Default: ['required', 'file', 'max:12288'] (12MB)
'directory' => null, // Example: 'tmp' | Default: 'livewire-tmp'
'middleware' => null, // Example: 'throttle:5,1' | Default: 'throttle:60,1'
'preview_mimes' => [ // Supported file types for temporary pre-signed file URLs...
'png', 'gif', 'bmp', 'svg', 'wav', 'mp4',
'mov', 'avi', 'wmv', 'mp3', 'm4a',
'jpg', 'jpeg', 'mpga', 'webp', 'wma',
],
'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated...
'cleanup' => true, // Should cleanup temporary uploads older than 24 hrs...
],
/*
|---------------------------------------------------------------------------
| Render On Redirect
|---------------------------------------------------------------------------
|
| This value determines if Livewire will run a component's `render()` method
| after a redirect has been triggered using something like `redirect(...)`
| Setting this to true will render the view once more before redirecting
|
*/
'render_on_redirect' => false,
/*
|---------------------------------------------------------------------------
| Eloquent Model Binding
|---------------------------------------------------------------------------
|
| Previous versions of Livewire supported binding directly to eloquent model
| properties using wire:model by default. However, this behavior has been
| deemed too "magical" and has therefore been put under a feature flag.
|
*/
'legacy_model_binding' => false,
/*
|---------------------------------------------------------------------------
| Auto-inject Frontend Assets
|---------------------------------------------------------------------------
|
| By default, Livewire automatically injects its JavaScript and CSS into the
| <head> and <body> of pages containing Livewire components. By disabling
| this behavior, you need to use @livewireStyles and @livewireScripts.
|
*/
'inject_assets' => true,
/*
|---------------------------------------------------------------------------
| Navigate (SPA mode)
|---------------------------------------------------------------------------
|
| By adding `wire:navigate` to links in your Livewire application, Livewire
| will prevent the default link handling and instead request those pages
| via AJAX, creating an SPA-like effect. Configure this behavior here.
|
*/
'navigate' => [
'show_progress_bar' => true,
'progress_bar_color' => '#2299dd',
],
/*
|---------------------------------------------------------------------------
| HTML Morph Markers
|---------------------------------------------------------------------------
|
| Livewire intelligently "morphs" existing HTML into the newly rendered HTML
| after each update. To make this process more reliable, Livewire injects
| "markers" into the rendered Blade surrounding @if, @class & @foreach.
|
*/
'inject_morph_markers' => true,
/*
|---------------------------------------------------------------------------
| Pagination Theme
|---------------------------------------------------------------------------
|
| When enabling Livewire's pagination feature by using the `WithPagination`
| trait, Livewire will use Tailwind templates to render pagination views
| on the page. If you want Bootstrap CSS, you can specify: "bootstrap"
|
*/
'pagination_theme' => 'tailwind',
];

132
config/logging.php Normal file
View File

@ -0,0 +1,132 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that is utilized to write
| messages to your logs. The value provided here should match one of
| the channels present in the list of "channels" configured below.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Laravel
| utilizes the Monolog PHP logging library, which includes a variety
| of powerful log handlers and formatters that you're free to use.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => explode(',', env('LOG_STACK', 'single')),
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => env('LOG_DAILY_DAYS', 14),
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://' . env('PAPERTRAIL_URL') . ':' . env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

103
config/mail.php Normal file
View File

@ -0,0 +1,103 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send all email
| messages unless another mailer is explicitly specified when sending
| the message. All additional mailers can be configured within the
| "mailers" array. Examples of each type of mailer are provided.
|
*/
'default' => env('MAIL_MAILER', 'log'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers that can be used
| when delivering an email. You may specify which one you're using for
| your mailers below. You may also add additional mailers if needed.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "log", "array", "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', '127.0.0.1'),
'port' => env('MAIL_PORT', 2525),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
],
'ses' => [
'transport' => 'ses',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
// 'client' => [
// 'timeout' => 5,
// ],
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all emails sent by your application to be sent from
| the same address. Here you may specify a name and address that is
| used globally for all emails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
];

186
config/permission.php Normal file
View File

@ -0,0 +1,186 @@
<?php
return [
'models' => [
/*
* When using the "HasPermissions" trait from this package, we need to know which
* Eloquent model should be used to retrieve your permissions. Of course, it
* is often just the "Permission" model but you may use whatever you like.
*
* The model you want to use as a Permission model needs to implement the
* `Spatie\Permission\Contracts\Permission` contract.
*/
'permission' => Spatie\Permission\Models\Permission::class,
/*
* When using the "HasRoles" trait from this package, we need to know which
* Eloquent model should be used to retrieve your roles. Of course, it
* is often just the "Role" model but you may use whatever you like.
*
* The model you want to use as a Role model needs to implement the
* `Spatie\Permission\Contracts\Role` contract.
*/
'role' => Spatie\Permission\Models\Role::class,
],
'table_names' => [
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'roles' => 'roles',
/*
* When using the "HasPermissions" trait from this package, we need to know which
* table should be used to retrieve your permissions. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'permissions' => 'permissions',
/*
* When using the "HasPermissions" trait from this package, we need to know which
* table should be used to retrieve your models permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_permissions' => 'model_has_permissions',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your models roles. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_roles' => 'model_has_roles',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'role_has_permissions' => 'role_has_permissions',
],
'column_names' => [
/*
* Change this if you want to name the related pivots other than defaults
*/
'role_pivot_key' => null, //default 'role_id',
'permission_pivot_key' => null, //default 'permission_id',
/*
* Change this if you want to name the related model primary key other than
* `model_id`.
*
* For example, this would be nice if your primary keys are all UUIDs. In
* that case, name this `model_uuid`.
*/
'model_morph_key' => 'model_id',
/*
* Change this if you want to use the teams feature and your related model's
* foreign key is other than `team_id`.
*/
'team_foreign_key' => 'team_id',
],
/*
* When set to true, the method for checking permissions will be registered on the gate.
* Set this to false if you want to implement custom logic for checking permissions.
*/
'register_permission_check_method' => true,
/*
* When set to true, Laravel\Octane\Events\OperationTerminated event listener will be registered
* this will refresh permissions on every TickTerminated, TaskTerminated and RequestTerminated
* NOTE: This should not be needed in most cases, but an Octane/Vapor combination benefited from it.
*/
'register_octane_reset_listener' => false,
/*
* Teams Feature.
* When set to true the package implements teams using the 'team_foreign_key'.
* If you want the migrations to register the 'team_foreign_key', you must
* set this to true before doing the migration.
* If you already did the migration then you must make a new migration to also
* add 'team_foreign_key' to 'roles', 'model_has_roles', and 'model_has_permissions'
* (view the latest version of this package's migration file)
*/
'teams' => false,
/*
* Passport Client Credentials Grant
* When set to true the package will use Passports Client to check permissions
*/
'use_passport_client_credentials' => false,
/*
* When set to true, the required permission names are added to exception messages.
* This could be considered an information leak in some contexts, so the default
* setting is false here for optimum safety.
*/
'display_permission_in_exception' => false,
/*
* When set to true, the required role names are added to exception messages.
* This could be considered an information leak in some contexts, so the default
* setting is false here for optimum safety.
*/
'display_role_in_exception' => false,
/*
* By default wildcard permission lookups are disabled.
* See documentation to understand supported syntax.
*/
'enable_wildcard_permission' => false,
/*
* The class to use for interpreting wildcard permissions.
* If you need to modify delimiters, override the class and specify its name here.
*/
// 'permission.wildcard_permission' => Spatie\Permission\WildcardPermission::class,
/* Cache-specific settings */
'cache' => [
/*
* By default all permissions are cached for 24 hours to speed up performance.
* When permissions or roles are updated the cache is flushed automatically.
*/
'expiration_time' => \DateInterval::createFromDateString('24 hours'),
/*
* The cache key used to store all permissions.
*/
'key' => 'spatie.permission.cache',
/*
* You may optionally indicate a specific cache driver to use for permission and
* role caching using any of the `store` drivers listed in the cache.php config
* file. Using 'default' here means to use the `default` set in cache.php.
*/
'store' => 'default',
],
];

112
config/queue.php Normal file
View File

@ -0,0 +1,112 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue supports a variety of backends via a single, unified
| API, giving you convenient access to each backend using identical
| syntax for each. The default queue connection is defined below.
|
*/
'default' => env('QUEUE_CONNECTION', 'database'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection options for every queue backend
| used by your application. An example configuration is provided for
| each backend supported by Laravel. You're also free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'connection' => env('DB_QUEUE_CONNECTION', null),
'table' => env('DB_QUEUE_TABLE', 'jobs'),
'queue' => env('DB_QUEUE', 'default'),
'retry_after' => env('DB_QUEUE_RETRY_AFTER', 90),
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
'queue' => env('BEANSTALKD_QUEUE', 'default'),
'retry_after' => env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => env('REDIS_QUEUE_RETRY_AFTER', 90),
'block_for' => null,
'after_commit' => false,
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control how and where failed jobs are stored. Laravel ships with
| support for storing failed jobs in a simple file or in a database.
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'failed_jobs',
],
];

83
config/sanctum.php Normal file
View File

@ -0,0 +1,83 @@
<?php
use Laravel\Sanctum\Sanctum;
return [
/*
|--------------------------------------------------------------------------
| Stateful Domains
|--------------------------------------------------------------------------
|
| Requests from the following domains / hosts will receive stateful API
| authentication cookies. Typically, these should include your local
| and production domains which access your API via a frontend SPA.
|
*/
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
'%s%s',
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
Sanctum::currentApplicationUrlWithPort()
))),
/*
|--------------------------------------------------------------------------
| Sanctum Guards
|--------------------------------------------------------------------------
|
| This array contains the authentication guards that will be checked when
| Sanctum is trying to authenticate a request. If none of these guards
| are able to authenticate the request, Sanctum will use the bearer
| token that's present on an incoming request for authentication.
|
*/
'guard' => ['web'],
/*
|--------------------------------------------------------------------------
| Expiration Minutes
|--------------------------------------------------------------------------
|
| This value controls the number of minutes until an issued token will be
| considered expired. This will override any values set in the token's
| "expires_at" attribute, but first-party sessions are not affected.
|
*/
'expiration' => null,
/*
|--------------------------------------------------------------------------
| Token Prefix
|--------------------------------------------------------------------------
|
| Sanctum can prefix new tokens in order to take advantage of numerous
| security scanning initiatives maintained by open source platforms
| that notify developers if they commit tokens into repositories.
|
| See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning
|
*/
'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''),
/*
|--------------------------------------------------------------------------
| Sanctum Middleware
|--------------------------------------------------------------------------
|
| When authenticating your first-party SPA with Sanctum you may need to
| customize some of the middleware Sanctum uses while processing the
| request. You may change the middleware listed below as required.
|
*/
'middleware' => [
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class,
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
],
];

44
config/services.php Normal file
View File

@ -0,0 +1,44 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
'facebook' => [
'client_id' => env('FACEBOOK_CLIENT_ID'),
'client_secret' => env('FACEBOOK_CLIENT_SECRET'),
'redirect' => env('FACEBOOK_REDIRECT'),
],
'google' => [
'client_id' => env('GOOGLE_CLIENT_ID'),
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
'redirect' => env('GOOGLE_CLIENT_SECRET'),
],
];

218
config/session.php Normal file
View File

@ -0,0 +1,218 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option determines the default session driver that is utilized for
| incoming requests. Laravel supports a variety of storage options to
| persist session data. Database storage is a great default choice.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to expire immediately when the browser is closed then you may
| indicate that via the expire_on_close configuration option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it's stored. All encryption is performed
| automatically by Laravel and you may use the session like normal.
|
*/
'encrypt' => env('SESSION_ENCRYPT', false),
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When utilizing the "file" session driver, the session files are placed
| on disk. The default storage location is defined here; however, you
| are free to provide another location where they should be stored.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table to
| be used to store sessions. Of course, a sensible default is defined
| for you; however, you're welcome to change this to another table.
|
*/
'table' => env('SESSION_TABLE', 'sessions'),
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using one of the framework's cache driven session backends, you may
| define the cache store which should be used to store the session data
| between requests. This must match one of your defined cache stores.
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the session cookie that is created by
| the framework. Typically, you should not need to change this value
| since doing so does not grant a meaningful security improvement.
|
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_') . '_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application, but you're free to change this when necessary.
|
*/
'path' => env('SESSION_PATH', '/'),
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| This value determines the domain and subdomains the session cookie is
| available to. By default, the cookie will be available to the root
| domain and all subdomains. Typically, this shouldn't be changed.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. It's unlikely you should disable this option.
|
*/
'http_only' => env('SESSION_HTTP_ONLY', true),
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" to permit secure cross-site requests.
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => env('SESSION_SAME_SITE', 'lax'),
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
];

View File

@ -0,0 +1,17 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Modules\Admin\Database\seeders\AdminDatabaseSeeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
$this->call(AdminDatabaseSeeder::class);
}
}

55
docker-compose.yml Normal file
View File

@ -0,0 +1,55 @@
version: '3'
services:
laravel.test:
build:
context: ./docker/8.2
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.2/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
mysql:
image: 'mysql/mysql-server:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_ROOT_HOST: '%'
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 1
volumes:
- 'sail-mysql:/var/lib/mysql'
- './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh'
networks:
- sail
healthcheck:
test:
- CMD
- mysqladmin
- ping
- '-p${DB_PASSWORD}'
retries: 3
timeout: 5s
networks:
sail:
driver: bridge
volumes:
sail-mysql:
driver: local

57
docker/7.4/Dockerfile Normal file
View File

@ -0,0 +1,57 @@
FROM ubuntu:20.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=16
ARG POSTGRES_VERSION=13
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu focal main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php7.4-cli php7.4-dev \
php7.4-pgsql php7.4-sqlite3 php7.4-gd php7.4-imagick \
php7.4-curl php7.4-memcached \
php7.4-imap php7.4-mysql php7.4-mbstring \
php7.4-xml php7.4-zip php7.4-bcmath php7.4-soap \
php7.4-intl php7.4-readline php7.4-pcov \
php7.4-msgpack php7.4-igbinary php7.4-ldap \
php7.4-redis php7.4-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php7.4
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/7.4/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 8000
ENTRYPOINT ["start-container"]

7
docker/7.4/php.ini Normal file
View File

@ -0,0 +1,7 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi

View File

@ -0,0 +1,14 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

59
docker/8.0/Dockerfile Normal file
View File

@ -0,0 +1,59 @@
FROM ubuntu:20.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=16
ARG POSTGRES_VERSION=13
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu focal main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.0-cli php8.0-dev \
php8.0-pgsql php8.0-sqlite3 php8.0-gd php8.0-imagick \
php8.0-curl php8.0-memcached \
php8.0-imap php8.0-mysql php8.0-mbstring \
php8.0-xml php8.0-zip php8.0-bcmath php8.0-soap \
php8.0-intl php8.0-readline php8.0-pcov \
php8.0-msgpack php8.0-igbinary php8.0-ldap \
php8.0-redis php8.0-swoole php8.0-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN update-alternatives --set php /usr/bin/php8.0
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.0
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.0/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 8000
ENTRYPOINT ["start-container"]

7
docker/8.0/php.ini Normal file
View File

@ -0,0 +1,7 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi

View File

@ -0,0 +1,14 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

58
docker/8.1/Dockerfile Normal file
View File

@ -0,0 +1,58 @@
FROM ubuntu:22.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=18
ARG POSTGRES_VERSION=15
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.1-cli php8.1-dev \
php8.1-pgsql php8.1-sqlite3 php8.1-gd php8.1-imagick \
php8.1-curl \
php8.1-imap php8.1-mysql php8.1-mbstring \
php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap \
php8.1-intl php8.1-readline \
php8.1-ldap \
php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole \
php8.1-memcached php8.1-pcov php8.1-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarn.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /usr/share/keyrings/pgdg.gpg >/dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.1
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.1/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 8000
ENTRYPOINT ["start-container"]

7
docker/8.1/php.ini Normal file
View File

@ -0,0 +1,7 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi

View File

@ -0,0 +1,14 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

58
docker/8.2/Dockerfile Normal file
View File

@ -0,0 +1,58 @@
FROM ubuntu:22.04
LABEL maintainer="Taylor Otwell"
ARG WWWGROUP
ARG NODE_VERSION=18
ARG POSTGRES_VERSION=15
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.2-cli php8.2-dev \
php8.2-pgsql php8.2-sqlite3 php8.2-gd php8.2-imagick \
php8.2-curl \
php8.2-imap php8.2-mysql php8.2-mbstring \
php8.2-xml php8.2-zip php8.2-bcmath php8.2-soap \
php8.2-intl php8.2-readline \
php8.2-ldap \
php8.2-msgpack php8.2-igbinary php8.2-redis php8.2-swoole \
php8.2-memcached php8.2-pcov php8.2-xdebug \
&& curl -sLS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer \
&& curl -sLS https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /etc/apt/keyrings/yarn.gpg >/dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/yarn.gpg] https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
&& curl -sS https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/keyrings/pgdg.gpg >/dev/null \
&& echo "deb [signed-by=/etc/apt/keyrings/pgdg.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& apt-get install -y yarn \
&& apt-get install -y mysql-client \
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.2
RUN groupadd --force -g $WWWGROUP sail
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY php.ini /etc/php/8.2/cli/conf.d/99-sail.ini
RUN chmod +x /usr/local/bin/start-container
EXPOSE 8000
ENTRYPOINT ["start-container"]

7
docker/8.2/php.ini Normal file
View File

@ -0,0 +1,7 @@
[PHP]
post_max_size = 100M
upload_max_filesize = 100M
variables_order = EGPCS
[opcache]
opcache.enable_cli=1

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
if [ ! -z "$WWWUSER" ]; then
usermod -u $WWWUSER sail
fi
if [ ! -d /.composer ]; then
mkdir /.composer
fi
chmod -R ugo+rw /.composer
if [ $# -gt 0 ]; then
exec gosu $WWWUSER "$@"
else
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
fi

View File

@ -0,0 +1,14 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:php]
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
user=sail
environment=LARAVEL_SAIL="1"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

View File

@ -0,0 +1,40 @@
<?php
namespace Modules\Admin\App\Actions\Fortify;
use Laravel\Fortify\Contracts\CreatesNewUsers;
use Modules\Admin\App\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
class CreateNewUser implements CreatesNewUsers
{
use PasswordValidationRules;
/**
* Validate and create a newly registered user.
*
* @param array<string, string> $input
*/
public function create(array $input): User
{
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
'email' => [
'required',
'string',
'email',
'max:255',
Rule::unique(User::class),
],
'password' => $this->passwordRules(),
])->validate();
return User::create([
'name' => $input['name'],
'email' => $input['email'],
'password' => Hash::make($input['password']),
]);
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace Modules\Admin\App\Actions\Fortify;
use Illuminate\Validation\Rules\Password;
trait PasswordValidationRules
{
/**
* Get the validation rules used to validate passwords.
*
* @return array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>
*/
protected function passwordRules(): array
{
return ['required', 'string', Password::default(), 'confirmed'];
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace Modules\Admin\App\Actions\Fortify;
use Laravel\Fortify\Contracts\ResetsUserPasswords;
use Modules\Admin\App\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class ResetUserPassword implements ResetsUserPasswords
{
use PasswordValidationRules;
/**
* Validate and reset the user's forgotten password.
*
* @param array<string, string> $input
*/
public function reset(User $user, array $input): void
{
Validator::make($input, [
'password' => $this->passwordRules(),
])->validate();
$user->forceFill([
'password' => Hash::make($input['password']),
])->save();
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace Modules\Admin\App\Actions\Fortify;
use Laravel\Fortify\Contracts\UpdatesUserPasswords;
use Modules\Admin\App\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class UpdateUserPassword implements UpdatesUserPasswords
{
use PasswordValidationRules;
/**
* Validate and update the user's password.
*
* @param array<string, string> $input
*/
public function update(User $user, array $input): void
{
Validator::make($input, [
'current_password' => ['required', 'string', 'current_password:web'],
'password' => $this->passwordRules(),
], [
'current_password.current_password' => __('The provided password does not match your current password.'),
])->validateWithBag('updatePassword');
$user->forceFill([
'password' => Hash::make($input['password']),
])->save();
}
}

View File

@ -0,0 +1,60 @@
<?php
namespace Modules\Admin\App\Actions\Fortify;
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
use Modules\Admin\App\Models\User;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
class UpdateUserProfileInformation implements UpdatesUserProfileInformation
{
/**
* Validate and update the given user's profile information.
*
* @param array<string, string> $input
*/
public function update(User $user, array $input): void
{
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
'email' => [
'required',
'string',
'email',
'max:255',
Rule::unique('users')->ignore($user->id),
],
])->validateWithBag('updateProfileInformation');
if (
$input['email'] !== $user->email &&
$user instanceof MustVerifyEmail
) {
$this->updateVerifiedUser($user, $input);
} else {
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
])->save();
}
}
/**
* Update the given verified user's profile information.
*
* @param array<string, string> $input
*/
protected function updateVerifiedUser(User $user, array $input): void
{
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
'email_verified_at' => null,
])->save();
$user->sendEmailVerificationNotification();
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace Modules\Admin\App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Storage;
class CleanInitialAvatars extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'avatars:clean-initial';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Elimina avatares generados automáticamente en el directorio initial-avatars';
/**
* Execute the console command.
*/
public function handle()
{
$directory = 'initial-avatars';
$files = Storage::disk('public')->files($directory);
foreach ($files as $file) {
$lastModified = Storage::disk('public')->lastModified($file);
// Elimina archivos no accedidos en los últimos 30 días
if (now()->timestamp - $lastModified > 30 * 24 * 60 * 60) {
Storage::disk('public')->delete($file);
}
}
$this->info('Avatares iniciales antiguos eliminados.');
}
}

View File

@ -0,0 +1,209 @@
<?php
namespace Modules\Admin\App\Helpers;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Str;
class Helpers
{
public static function appClasses()
{
$data = config('custom.custom');
// default data array
$DefaultData = [
'myLayout' => 'vertical',
'myTheme' => 'theme-default',
'myStyle' => 'light',
'myRTLSupport' => false,
'myRTLMode' => true,
'hasCustomizer' => true,
'showDropdownOnHover' => true,
'displayCustomizer' => true,
'contentLayout' => 'compact',
'headerType' => 'fixed',
'navbarType' => 'fixed',
'menuFixed' => true,
'menuCollapsed' => false,
'footerFixed' => false,
'customizerControls' => [
'rtl',
'style',
'headerType',
'contentLayout',
'layoutCollapsed',
'showDropdownOnHover',
'layoutNavbarOptions',
'themes',
],
// 'defaultLanguage'=>'en',
];
// if any key missing of array from custom.php file it will be merge and set a default value from dataDefault array and store in data variable
$data = array_merge($DefaultData, $data);
// All options available in the template
$allOptions = [
'myLayout' => ['vertical', 'horizontal', 'blank', 'front'],
'menuCollapsed' => [true, false],
'hasCustomizer' => [true, false],
'showDropdownOnHover' => [true, false],
'displayCustomizer' => [true, false],
'contentLayout' => ['compact', 'wide'],
'headerType' => ['fixed', 'static'],
'navbarType' => ['fixed', 'static', 'hidden'],
'myStyle' => ['light', 'dark', 'system'],
'myTheme' => ['theme-default', 'theme-bordered', 'theme-semi-dark'],
'myRTLSupport' => [true, false],
'myRTLMode' => [true, false],
'menuFixed' => [true, false],
'footerFixed' => [true, false],
'customizerControls' => [],
// 'defaultLanguage'=>array('en'=>'en','fr'=>'fr','de'=>'de','ar'=>'ar'),
];
//if myLayout value empty or not match with default options in custom.php config file then set a default value
foreach ($allOptions as $key => $value) {
if (array_key_exists($key, $DefaultData)) {
if (gettype($DefaultData[$key]) === gettype($data[$key])) {
// data key should be string
if (is_string($data[$key])) {
// data key should not be empty
if (isset($data[$key]) && $data[$key] !== null) {
// data key should not be exist inside allOptions array's sub array
if (!array_key_exists($data[$key], $value)) {
// ensure that passed value should be match with any of allOptions array value
$result = array_search($data[$key], $value, 'strict');
if (empty($result) && $result !== 0) {
$data[$key] = $DefaultData[$key];
}
}
} else {
// if data key not set or
$data[$key] = $DefaultData[$key];
}
}
} else {
$data[$key] = $DefaultData[$key];
}
}
}
$styleVal = $data['myStyle'] == "dark" ? "dark" : "light";
$styleUpdatedVal = $data['myStyle'] == "dark" ? "dark" : $data['myStyle'];
// Determine if the layout is admin or front based on cookies
$layoutName = $data['myLayout'];
$isAdmin = Str::contains($layoutName, 'front') ? false : true;
$modeCookieName = $isAdmin ? 'admin-mode' : 'front-mode';
$colorPrefCookieName = $isAdmin ? 'admin-colorPref' : 'front-colorPref';
// Determine style based on cookies, only if not 'blank-layout'
if ($layoutName !== 'blank') {
if (isset($_COOKIE[$modeCookieName])) {
$styleVal = $_COOKIE[$modeCookieName];
if ($styleVal === 'system') {
$styleVal = isset($_COOKIE[$colorPrefCookieName]) ? $_COOKIE[$colorPrefCookieName] : 'light';
}
$styleUpdatedVal = $_COOKIE[$modeCookieName];
}
}
isset($_COOKIE['theme']) ? $themeVal = $_COOKIE['theme'] : $themeVal = $data['myTheme'];
$directionVal = isset($_COOKIE['direction']) ? ($_COOKIE['direction'] === "true" ? 'rtl' : 'ltr') : $data['myRTLMode'];
//layout classes
$layoutClasses = [
'layout' => $data['myLayout'],
'theme' => $themeVal,
'themeOpt' => $data['myTheme'],
'style' => $styleVal,
'styleOpt' => $data['myStyle'],
'styleOptVal' => $styleUpdatedVal,
'rtlSupport' => $data['myRTLSupport'],
'rtlMode' => $data['myRTLMode'],
'textDirection' => $directionVal, //$data['myRTLMode'],
'menuCollapsed' => $data['menuCollapsed'],
'hasCustomizer' => $data['hasCustomizer'],
'showDropdownOnHover' => $data['showDropdownOnHover'],
'displayCustomizer' => $data['displayCustomizer'],
'contentLayout' => $data['contentLayout'],
'headerType' => $data['headerType'],
'navbarType' => $data['navbarType'],
'menuFixed' => $data['menuFixed'],
'footerFixed' => $data['footerFixed'],
'customizerControls' => $data['customizerControls'],
];
// sidebar Collapsed
if ($layoutClasses['menuCollapsed'] == true) {
$layoutClasses['menuCollapsed'] = 'layout-menu-collapsed';
}
// Header Type
if ($layoutClasses['headerType'] == 'fixed') {
$layoutClasses['headerType'] = 'layout-menu-fixed';
}
// Navbar Type
if ($layoutClasses['navbarType'] == 'fixed') {
$layoutClasses['navbarType'] = 'layout-navbar-fixed';
} elseif ($layoutClasses['navbarType'] == 'static') {
$layoutClasses['navbarType'] = '';
} else {
$layoutClasses['navbarType'] = 'layout-navbar-hidden';
}
// Menu Fixed
if ($layoutClasses['menuFixed'] == true) {
$layoutClasses['menuFixed'] = 'layout-menu-fixed';
}
// Footer Fixed
if ($layoutClasses['footerFixed'] == true) {
$layoutClasses['footerFixed'] = 'layout-footer-fixed';
}
// RTL Supported template
if ($layoutClasses['rtlSupport'] == true) {
$layoutClasses['rtlSupport'] = '/rtl';
}
// RTL Layout/Mode
if ($layoutClasses['rtlMode'] == true) {
$layoutClasses['rtlMode'] = 'rtl';
$layoutClasses['textDirection'] = isset($_COOKIE['direction']) ? ($_COOKIE['direction'] === "true" ? 'rtl' : 'ltr') : 'rtl';
} else {
$layoutClasses['rtlMode'] = 'ltr';
$layoutClasses['textDirection'] = isset($_COOKIE['direction']) && $_COOKIE['direction'] === "true" ? 'rtl' : 'ltr';
}
// Show DropdownOnHover for Horizontal Menu
if ($layoutClasses['showDropdownOnHover'] == true) {
$layoutClasses['showDropdownOnHover'] = true;
} else {
$layoutClasses['showDropdownOnHover'] = false;
}
// To hide/show display customizer UI, not js
if ($layoutClasses['displayCustomizer'] == true) {
$layoutClasses['displayCustomizer'] = true;
} else {
$layoutClasses['displayCustomizer'] = false;
}
return $layoutClasses;
}
public static function updatePageConfig($pageConfigs)
{
$demo = 'custom';
if (isset($pageConfigs)) {
if (count($pageConfigs) > 0) {
foreach ($pageConfigs as $config => $val) {
Config::set('custom.' . $demo . '.' . $config, $val);
}
}
}
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace Modules\Admin\App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Modules\Admin\App\Models\Setting;
use Modules\Admin\App\Services\VuexyAdminService;
class AdminController extends Controller
{
public function searchNavbar()
{
abort_if(!request()->expectsJson(), 403, __('errors.ajax_only'));
$VuexyAdminService = app(VuexyAdminService::class);
return response()->json($VuexyAdminService->getVuexySearchData());
}
public function quickLinksUpdate(Request $request)
{
abort_if(!request()->expectsJson(), 403, __('errors.ajax_only'));
$validated = $request->validate([
'action' => 'required|in:update,remove',
'route' => 'required|string',
]);
$quickLinks = Setting::where('user_id', Auth::user()->id)
->where('key', 'quicklinks')
->first();
$quickLinks = $quickLinks ? json_decode($quickLinks->value, true) : [];
if ($validated['action'] === 'update') {
// Verificar si ya existe
if (!in_array($validated['route'], $quickLinks))
$quickLinks[] = $validated['route'];
} elseif ($validated['action'] === 'remove') {
// Eliminar la ruta si existe
$quickLinks = array_filter($quickLinks, function ($route) use ($validated) {
return $route !== $validated['route'];
});
}
Setting::updateOrCreate(['user_id' => Auth::user()->id, 'key' => 'quicklinks'], ['value' => json_encode($quickLinks)]);
VuexyAdminService::clearQuickLinksCache();
}
public function generalSettings()
{
return view('admin::admin-settings.webapp-general-settings');
}
public function smtpSettings()
{
return view('admin::admin-settings.smtp-settings');
}
}

View File

@ -0,0 +1,144 @@
<?php
namespace Modules\Admin\App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Laravel\Fortify\Features;
class AuthController extends Controller
{
/*
public function loginView()
{
dd($viewMode);
$viewMode = config('custom.custom.authViewMode');
$pageConfigs = ['myLayout' => 'blank'];
return view("admin::auth.login-{$viewMode}", ['pageConfigs' => $pageConfigs]);
}
public function registerView()
{
if (!Features::enabled(Features::registration()))
abort(403, 'El registro está deshabilitado.');
$viewMode = config('custom.custom.authViewMode');
$pageConfigs = ['myLayout' => 'blank'];
return view("admin::auth.register-{$viewMode}", ['pageConfigs' => $pageConfigs]);
}
public function confirmPasswordView()
{
if (!Features::enabled(Features::registration()))
abort(403, 'El registro está deshabilitado.');
$viewMode = config('custom.custom.authViewMode');
$pageConfigs = ['myLayout' => 'blank'];
return view("admin::auth.confirm-password-{$viewMode}", ['pageConfigs' => $pageConfigs]);
}
public function resetPasswordView()
{
if (!Features::enabled(Features::resetPasswords()))
abort(403, 'El registro está deshabilitado.');
$viewMode = config('custom.custom.authViewMode');
$pageConfigs = ['myLayout' => 'blank'];
return view("admin::auth.reset-password-{$viewMode}", ['pageConfigs' => $pageConfigs]);
}
public function requestPasswordResetLinkView(Request $request)
{
if (!Features::enabled(Features::resetPasswords()))
abort(403, 'El registro está deshabilitado.');
$viewMode = config('custom.custom.authViewMode');
$pageConfigs = ['myLayout' => 'blank'];
return view("admin::auth.reset-password-{$viewMode}", ['pageConfigs' => $pageConfigs, 'request' => $request]);
}
public function twoFactorChallengeView()
{
if (!Features::enabled(Features::registration()))
abort(403, 'El registro está deshabilitado.');
$viewMode = config('custom.custom.authViewMode');
$pageConfigs = ['myLayout' => 'blank'];
return view("admin::auth.two-factor-challenge-{$viewMode}", ['pageConfigs' => $pageConfigs]);
}
public function twoFactorRecoveryCodesView()
{
if (!Features::enabled(Features::registration()))
abort(403, 'El registro está deshabilitado.');
$viewMode = config('custom.custom.authViewMode');
$pageConfigs = ['myLayout' => 'blank'];
return view("admin::auth.register-{$viewMode}", ['pageConfigs' => $pageConfigs]);
}
public function twoFactorAuthenticationView()
{
if (!Features::enabled(Features::registration()))
abort(403, 'El registro está deshabilitado.');
$viewMode = config('custom.custom.authViewMode');
$pageConfigs = ['myLayout' => 'blank'];
return view("admin::auth.register-{$viewMode}", ['pageConfigs' => $pageConfigs]);
}
public function verifyEmailView()
{
if (!Features::enabled(Features::registration()))
abort(403, 'El registro está deshabilitado.');
$viewMode = config('custom.custom.authViewMode');
$pageConfigs = ['myLayout' => 'blank'];
return view("admin::auth.verify-email-{$viewMode}", ['pageConfigs' => $pageConfigs]);
}
public function showEmailVerificationForm()
{
if (!Features::enabled(Features::registration()))
abort(403, 'El registro está deshabilitado.');
$viewMode = config('custom.custom.authViewMode');
$pageConfigs = ['myLayout' => 'blank'];
return view("admin::auth.register-{$viewMode}", ['pageConfigs' => $pageConfigs]);
}
public function userProfileView()
{
if (!Features::enabled(Features::registration()))
abort(403, 'El registro está deshabilitado.');
$viewMode = config('custom.custom.authViewMode');
$pageConfigs = ['myLayout' => 'blank'];
return view("admin::auth.register-{$viewMode}", ['pageConfigs' => $pageConfigs]);
}
*/
}

View File

@ -0,0 +1,41 @@
<?php
namespace Modules\Admin\App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Artisan;
use Modules\Admin\App\Services\CacheConfigService;
class CacheController extends Controller
{
public function generateConfigCache()
{
try {
// Lógica para generar cache
Artisan::call('config:cache');
return response()->json(['success' => true, 'message' => 'Cache generado correctamente.']);
} catch (\Exception $e) {
return response()->json(['success' => false, 'message' => 'Error al generar el cache.', 'error' => $e->getMessage()], 500);
}
}
public function generateRouteCache()
{
try {
// Lógica para generar cache de rutas
Artisan::call('route:cache');
return response()->json(['success' => true, 'message' => 'Cache de rutas generado correctamente.']);
} catch (\Exception $e) {
return response()->json(['success' => false, 'message' => 'Error al generar el cache de rutas.', 'error' => $e->getMessage()], 500);
}
}
public function cacheManager(CacheConfigService $cacheConfigService)
{
$configCache = $cacheConfigService->getConfig();
return view('admin::cache-manager.index', compact('configCache'));
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace Modules\Admin\App\Http\Controllers;
use App\Http\Controllers\Controller;
class HomeController extends Controller
{
public function index()
{
return view('admin::pages.home');
}
public function about()
{
return view('admin::pages.about');
}
public function comingsoon()
{
$pageConfigs = ['myLayout' => 'blank'];
return view('admin::pages.comingsoon', compact('pageConfigs'));
}
public function underMaintenance()
{
$pageConfigs = ['myLayout' => 'blank'];
return view('admin::pages.under-maintenance', compact('pageConfigs'));
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace Modules\Admin\App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Spatie\Permission\Models\Permission;
use Yajra\DataTables\Facades\DataTables;
use App\Http\Controllers\Controller;
class PermissionController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
if ($request->ajax()) {
$permissions = Permission::latest()->get();
return DataTables::of($permissions)
->addIndexColumn()
->addColumn('assigned_to', function ($row) {
return (Arr::pluck($row->roles, ['name']));
})
->editColumn('created_at', function ($request) {
return $request->created_at->format('Y-m-d h:i:s a');
})
->make(true);
}
return view('admin::permissions.index');
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace Modules\Admin\App\Http\Controllers;
use Illuminate\Http\Request;
use Spatie\Permission\Models\Role;
use App\Http\Controllers\Controller;
class RoleController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
return view('admin::roles.index');
}
public function checkUniqueRoleName(Request $request)
{
$id = $request->input('id');
$name = $request->input('name');
// Verificar si el nombre ya existe en la base de datos
$existingRole = Role::where('name', $name)
->whereNot('id', $id)
->first();
if ($existingRole) {
return response()->json(['valid' => false]);
}
return response()->json(['valid' => true]);
}
}

View File

@ -0,0 +1,194 @@
<?php
namespace Modules\Admin\App\Http\Controllers;
use Modules\Admin\App\Imports\SatCatalogsImport;
use Maatwebsite\Excel\Facades\Excel;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use App\Http\Controllers\Controller;
class SatCatalogController extends Controller
{
/**
* @return \Illuminate\Support\Collection
*/
public function import(Request $request)
{
// Si es una solicitud POST, procesa la importación
if ($request->isMethod('post')) {
$validator = Validator::make($request->all(), [
'file' => ['required', 'mimes:xls,xlsx'],
]);
if ($validator->fails())
return back()->withInput()->withErrors($validator);
$time_start = microtime(true);
$results = [
'details' => [],
'total_rows' => 0,
'total_created' => 0,
'total_updated' => 0,
'total_time' => 0,
];
$import = new SatCatalogsImport();
$filePath = request()->file('file');
$time_sheet_start = microtime(true);
$import->onlySheets('c_FormaPago');
Excel::import($import, $filePath);
$results['details'][] = [
'name' => 'Forma de pago',
'time' => round(microtime(true) - $time_sheet_start, 2),
'created' => session('created'),
'updated' => session('updated'),
];
$results['total_rows'] += session('created') + session('updated');
$results['total_created'] += session('created');
$results['total_updated'] += session('updated');
$time_sheet_start = microtime(true);
$import->onlySheets('c_Moneda');
Excel::import($import, $filePath);
$results['details'][] = [
'name' => 'Moneda',
'time' => round(microtime(true) - $time_sheet_start, 2),
'created' => session('created'),
'updated' => session('updated'),
];
$results['total_rows'] += session('created') + session('updated');
$results['total_created'] += session('created');
$results['total_updated'] += session('updated');
$time_sheet_start = microtime(true);
$import->onlySheets('c_CodigoPostal_Parte_1');
Excel::import($import, $filePath);
$import->onlySheets('c_CodigoPostal_Parte_2');
Excel::import($import, $filePath);
$results['details'][] = [
'name' => 'Código postal',
'time' => round(microtime(true) - $time_sheet_start, 2),
'created' => session('created'),
'updated' => session('updated'),
];
$time_sheet_start = microtime(true);
$import->onlySheets('c_RegimenFiscal');
Excel::import($import, $filePath);
$results['details'][] = [
'name' => 'Regimen fiscal',
'time' => round(microtime(true) - $time_sheet_start, 2),
'created' => session('created'),
'updated' => session('updated'),
];
$results['total_rows'] += session('created') + session('updated');
$results['total_created'] += session('created');
$results['total_updated'] += session('updated');
$time_sheet_start = microtime(true);
$import->onlySheets('c_Pais');
Excel::import($import, $filePath);
$results['details'][] = [
'name' => 'País',
'time' => round(microtime(true) - $time_sheet_start, 2),
'created' => session('created'),
'updated' => session('updated'),
];
$results['total_rows'] += session('created') + session('updated');
$results['total_created'] += session('created');
$results['total_updated'] += session('updated');
$time_sheet_start = microtime(true);
$import->onlySheets('c_UsoCFDI');
Excel::import($import, $filePath);
$results['details'][] = [
'name' => 'Uso de CFDI',
'time' => round(microtime(true) - $time_sheet_start, 2),
'created' => session('created'),
'updated' => session('updated'),
];
$results['total_rows'] += session('created') + session('updated');
$results['total_created'] += session('created');
$results['total_updated'] += session('updated');
$time_sheet_start = microtime(true);
$import->onlySheets('C_Colonia_1');
Excel::import($import, $filePath);
$time_sheet_start = microtime(true);
$import->onlySheets('C_Colonia_2');
Excel::import($import, $filePath);
$time_sheet_start = microtime(true);
$import->onlySheets('C_Colonia_3');
Excel::import($import, $filePath);
$results['details'][] = [
'name' => 'Colonia',
'time' => round(microtime(true) - $time_sheet_start, 2),
'created' => session('created'),
'updated' => session('updated'),
];
$results['total_rows'] += session('created') + session('updated');
$results['total_created'] += session('created');
$results['total_updated'] += session('updated');
$time_sheet_start = microtime(true);
$import->onlySheets('c_Estado');
Excel::import($import, $filePath);
$results['details'][] = [
'name' => 'Estado',
'time' => round(microtime(true) - $time_sheet_start, 2),
'created' => session('created'),
'updated' => session('updated'),
];
$results['total_rows'] += session('created') + session('updated');
$results['total_created'] += session('created');
$results['total_updated'] += session('updated');
$time_sheet_start = microtime(true);
$import->onlySheets('C_Localidad');
Excel::import($import, $filePath);
$results['details'][] = [
'name' => 'Localidad',
'time' => round(microtime(true) - $time_sheet_start, 2),
'created' => session('created'),
'updated' => session('updated'),
];
$results['total_rows'] += session('created') + session('updated');
$results['total_created'] += session('created');
$results['total_updated'] += session('updated');
$time_sheet_start = microtime(true);
$import->onlySheets('C_Municipio');
Excel::import($import, $filePath);
$results['details'][] = [
'name' => 'Municipio',
'time' => round(microtime(true) - $time_sheet_start, 2),
'created' => session('created'),
'updated' => session('updated'),
];
$results['total_rows'] += session('created') + session('updated');
$results['total_created'] += session('created');
$results['total_updated'] += session('updated');
$results['total_time'] = round(microtime(true) - $time_start, 2);
return back()->with('results', $results);
}
return view('system::import-sat.index');
}
}

View File

@ -0,0 +1,182 @@
<?php
namespace Modules\Admin\App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Auth;
use Yajra\DataTables\Facades\DataTables;
use Modules\Admin\App\Models\User;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
if ($request->ajax()) {
$users = User::when(!Auth::user()->hasRole('SuperAdmin'), function ($query) {
$query->where('id', '>', 1);
})
->latest()
->get();
return DataTables::of($users)
->only(['id', 'name', 'email', 'avatar', 'roles', 'status', 'created_at'])
->addIndexColumn()
->addColumn('avatar', function ($user) {
return $user->profile_photo_url;
})
->addColumn('roles', function ($user) {
return (Arr::pluck($user->roles, ['name']));
})
/*
->addColumn('stores', function ($user) {
return (Arr::pluck($user->stores, ['nombre']));
})
y*/
->editColumn('created_at', function ($user) {
return $user->created_at->format('Y-m-d');
})
->make(true);
}
return view('admin::users.index');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$validator = Validator::make($request->all(), [
'name' => 'required|max:255',
'email' => 'required|max:255|unique:users',
'photo' => 'nullable|mimes:jpg,jpeg,png|max:1024',
'password' => 'required',
]);
if ($validator->fails())
return response()->json(['errors' => $validator->errors()->all()]);
// Preparamos los datos
$user_request = array_merge_recursive($request->all(), [
'remember_token' => Str::random(10),
'created_by' => Auth::user()->id,
]);
$user_request['password'] = bcrypt($request->password);
// Guardamos el nuevo usuario
$user = User::create($user_request);
// Asignmos los permisos
$user->assignRole($request->roles);
// Asignamos Tiendas
//$user->stores()->attach($request->stores);
if ($request->file('photo'))
$user->updateProfilePhoto($request->file('photo'));
return response()->json(['success' => 'Se agrego correctamente el usuario']);
}
/**
* Display the specified resource.
*
* @param int User $user
* @return \Illuminate\Http\Response
*/
public function show(User $user)
{
return view('admin::users.show', compact('user'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int User $user
* @return \Illuminate\Http\Response
*/
public function updateAjax(Request $request, User $user)
{
// Validamos los datos
$validator = Validator::make($request->all(), [
'name' => 'required|max:191',
'email' => "required|max:191|unique:users,email," . $user->id,
'photo' => 'nullable|mimes:jpg,jpeg,png|max:2048'
]);
if ($validator->fails())
return response()->json(['errors' => $validator->errors()->all()]);
// Preparamos los datos
$user_request = $request->all();
if ($request->password) {
$user_request['password'] = bcrypt($request->password);
} else {
unset($user_request['password']);
}
// Guardamos los cambios
$user->update($user_request);
// Sincronizamos Roles
$user->syncRoles($request->roles);
// Sincronizamos Tiendas
//$user->stores()->sync($request->stores);
// Actualizamos foto de perfil
if ($request->file('photo'))
$user->updateProfilePhoto($request->file('photo'));
return response()->json(['success' => 'Se guardo correctamente los cambios.']);
}
public function userSettings(User $user)
{
return view('admin::users.user-settings', compact('user'));
}
public function generateAvatar(Request $request)
{
// Validación de entrada
$request->validate([
'name' => 'nullable|string',
'color' => 'nullable|string|size:6',
'background' => 'nullable|string|size:6',
'size' => 'nullable|integer|min:20|max:1024'
]);
$name = $request->get('name', 'NA');
$color = $request->get('color', '7F9CF5');
$background = $request->get('background', 'EBF4FF');
$size = $request->get('size', 100);
return User::getAvatarImage($name, $color, $background, $size);
try {
} catch (\Exception $e) {
// String base64 de una imagen PNG transparente de 1x1 píxel
$transparentBase64 = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==';
return response()->make(base64_decode($transparentBase64), 200, [
'Content-Type' => 'image/png'
]);
}
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace Modules\Admin\App\Http\Controllers;
use App\Http\Controllers\Controller;
class WebsiteSettingController extends Controller
{
public function generalSettings()
{
return view('admin::website-settings.general-settings-index');
}
public function legal()
{
return view('admin::website-settings.legal-index');
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace Modules\Admin\App\Http\Middleware;
use Closure;
use Modules\Admin\App\Services\AdminTemplateService;
use Illuminate\Support\Facades\View;
class AdminTemplateMiddleware
{
public function __construct()
{
//
}
public function handle($request, Closure $next)
{
// Verificar si estamos en el contexto de website
if (!$request->is('admin/*') && !$request->is('admin')) {
return $next($request);
}
// Compartir variables globalmente solo si es una solicitud HTML
if (str_contains($request->header('Accept'), 'text/html')) {
$adminVars = app(AdminTemplateService::class)->getAdminVars();
View::share('_admin', $adminVars);
}
return $next($request);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Modules\Admin\App\Http\View\Composers;
use Illuminate\View\View;
use Modules\Admin\App\Services\VuexyAdminService;
class VuexyTemplateComposer
{
protected $vuexyAdminService;
public function __construct(VuexyAdminService $vuexyAdminService)
{
$this->vuexyAdminService = $vuexyAdminService;
}
public function compose(View $view)
{
$view->with([
'vuexyMenu' => $this->vuexyAdminService->getMenu(),
'vuexySearch' => $this->vuexyAdminService->getSearch(),
'vuexyQuickLinks' => $this->vuexyAdminService->getQuickLinks(),
'vuexyNotifications' => $this->vuexyAdminService->getNotifications(),
'vuexyBreadcrumbs' => $this->vuexyAdminService->getBreadcrumbs(),
]);
}
}

View File

@ -0,0 +1,78 @@
<?php
namespace Modules\Admin\App\Imports;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\ToCollection;
class SATCodigoPostalImport implements ToCollection
{
public function collection(Collection $collection)
{
$batchSize = 1000;
$batchData = [];
$processedRows = 0;
foreach ($collection as $key => $row) {
if ($key < 7 || !$row[1]) {
continue;
}
$requestArray = [
'c_codigo_postal' => $row[0],
'c_estado' => $row[1],
'c_municipio' => $row[2],
'c_localidad' => $row[3],
'estimulo_franja_fronteriza' => $row[4],
'fecha_inicio_de_vigencia' => $row[5] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[5])) :
null,
'fecha_fin_de_vigencia' => $row[6] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[6])) :
null,
];
$batchData[] = $requestArray;
$processedRows++;
if (count($batchData) >= $batchSize) {
$this->insertBatch($batchData);
$batchData = [];
}
}
if (!empty($batchData)) {
$this->insertBatch($batchData);
}
echo "\n\033[32mImport completed: Processed $processedRows rows.\033[0m\n";
}
private function insertBatch(array $batchData)
{
try {
DB::table('sat_codigo_postal')->upsert(
$batchData,
[
'c_codigo_postal'
],
[
'c_estado',
'c_municipio',
'c_localidad',
'estimulo_franja_fronteriza',
'fecha_inicio_de_vigencia',
'fecha_fin_de_vigencia'
]
);
} catch (\Exception $e) {
echo "Error in batch: " . $e->getMessage() . "\n";
foreach ($batchData as $row) {
echo "Row data: " . json_encode($row) . "\n";
}
}
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace Modules\Admin\App\Imports;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\ToCollection;
class SATColoniaImport implements ToCollection
{
/**
* @param Collection $collection
*/
public function collection(Collection $collection)
{
$batchSize = 1000;
$batchData = [];
$processedRows = 0;
foreach ($collection as $key => $row) {
if ($key < 5 || !$row[1]) {
continue;
}
$requestArray = [
'c_colonia' => $row[0],
'c_codigo_postal' => $row[1],
'nombre_del_asentamiento' => $row[2],
];
$batchData[] = $requestArray;
$processedRows++;
if (count($batchData) >= $batchSize) {
$this->insertBatch($batchData);
$batchData = [];
}
}
if (!empty($batchData)) {
$this->insertBatch($batchData);
}
echo "\n\033[32mImport completed: Processed $processedRows rows.\033[0m\n";
}
private function insertBatch(array $batchData)
{
try {
DB::table('sat_colonia')->upsert(
$batchData,
[
'c_colonia',
'c_codigo_postal',
],
[
'nombre_del_asentamiento',
]
);
} catch (\Exception $e) {
echo "Error in batch: " . $e->getMessage() . "\n";
foreach ($batchData as $row) {
echo "Row data: " . json_encode($row) . "\n";
}
}
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace Modules\Admin\App\Imports;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\ToCollection;
class SATEstadoImport implements ToCollection
{
/**
* @param Collection $collection
*/
public function collection(Collection $collection)
{
$batchSize = 1000;
$batchData = [];
$processedRows = 0;
foreach ($collection as $key => $row) {
if ($key < 5 || !$row[1]) {
continue;
}
$requestArray = [
'c_estado' => $row[0],
'c_pais' => $row[1],
'nombre_del_estado' => $row[2],
'fecha_inicio_de_vigencia' => $row[3] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[3])) :
null,
'fecha_fin_de_vigencia' => $row[4] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[4])) :
null,
];
$batchData[] = $requestArray;
$processedRows++;
if (count($batchData) >= $batchSize) {
$this->insertBatch($batchData);
$batchData = [];
}
}
if (!empty($batchData)) {
$this->insertBatch($batchData);
}
echo "\n\033[32mImport completed: Processed $processedRows rows.\033[0m\n";
}
private function insertBatch(array $batchData)
{
try {
DB::table('sat_estado')->upsert(
$batchData,
[
'c_estado',
'c_pais',
],
[
'nombre_del_estado',
'fecha_inicio_de_vigencia',
'fecha_fin_de_vigencia',
]
);
} catch (\Exception $e) {
echo "Error in batch: " . $e->getMessage() . "\n";
foreach ($batchData as $row) {
echo "Row data: " . json_encode($row) . "\n";
}
}
}
}

View File

@ -0,0 +1,95 @@
<?php
namespace Modules\Admin\App\Imports;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\ToCollection;
class SATFormaPagoImport implements ToCollection
{
/**
* @param Collection $collection
*/
public function collection(Collection $collection)
{
$batchSize = 1000;
$batchData = [];
$processedRows = 0;
foreach ($collection as $key => $row) {
if ($key < 6 || !$row[1]) {
continue;
}
$requestArray = [
'c_forma_pago' => $row[0],
'descripcion' => $row[1],
'bancarizado' => $row[2],
'numero_de_operacion' => $row[3],
'rfc_del_emisor_de_la_cuenta_ordenante' => $row[4],
'cuenta_ordenante' => $row[5],
'patron_para_cuenta_ordenante' => $row[6],
'rfc_del_emisor_cuenta_de_beneficiario' => $row[7],
'cuenta_de_benenficiario' => $row[8],
'patron_para_cuenta_beneficiaria' => $row[9],
'tipo_cadena_pago' => $row[10],
'banco_emisor_de_la_cuenta_ordenante' => $row[11],
'fecha_inicio_de_vigencia' => $row[12] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[12])) :
null,
'fecha_fin_de_vigencia' => $row[13] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[13])) :
null,
];
$batchData[] = $requestArray;
$processedRows++;
if (count($batchData) >= $batchSize) {
$this->insertBatch($batchData);
$batchData = [];
}
}
if (!empty($batchData)) {
$this->insertBatch($batchData);
}
echo "\n\033[32mImport completed: Processed $processedRows rows.\033[0m\n";
}
private function insertBatch(array $batchData)
{
try {
DB::table('sat_forma_pago')->upsert(
$batchData,
[
'c_forma_pago',
],
[
'descripcion',
'bancarizado',
'numero_de_operacion',
'rfc_del_emisor_de_la_cuenta_ordenante',
'cuenta_ordenante',
'patron_para_cuenta_ordenante',
'rfc_del_emisor_cuenta_de_beneficiario',
'cuenta_de_benenficiario',
'patron_para_cuenta_beneficiaria',
'tipo_cadena_pago',
'banco_emisor_de_la_cuenta_ordenante',
'fecha_inicio_de_vigencia',
'fecha_fin_de_vigencia',
]
);
} catch (\Exception $e) {
echo "Error in batch: " . $e->getMessage() . "\n";
foreach ($batchData as $row) {
echo "Row data: " . json_encode($row) . "\n";
}
}
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace Modules\Admin\App\Imports;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\ToCollection;
class SATLocalidadImport implements ToCollection
{
/**
* @param Collection $collection
*/
public function collection(Collection $collection)
{
$batchSize = 1000;
$batchData = [];
$processedRows = 0;
foreach ($collection as $key => $row) {
if ($key < 5 || !$row[1]) {
continue;
}
$requestArray = [
'c_localidad' => $row[0],
'c_estado' => $row[1],
'descripcion' => $row[2],
'fecha_de_inicio_de_vigencia' => $row[3] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[3])) :
null,
'fecha_de_fin_de_vigencia' => $row[4] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[4])) :
null,
];
$batchData[] = $requestArray;
$processedRows++;
if (count($batchData) >= $batchSize) {
$this->insertBatch($batchData);
$batchData = [];
}
}
if (!empty($batchData)) {
$this->insertBatch($batchData);
}
echo "\n\033[32mImport completed: Processed $processedRows rows.\033[0m\n";
}
private function insertBatch(array $batchData)
{
try {
DB::table('sat_localidad')->upsert(
$batchData,
[
'c_localidad',
'c_estado',
],
[
'descripcion',
'fecha_de_inicio_de_vigencia',
'fecha_de_fin_de_vigencia'
]
);
} catch (\Exception $e) {
echo "Error in batch: " . $e->getMessage() . "\n";
foreach ($batchData as $row) {
echo "Row data: " . json_encode($row) . "\n";
}
}
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace Modules\Admin\App\Imports;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\ToCollection;
class SATMonedaImport implements ToCollection
{
/**
* @param Collection $collection
*/
public function collection(Collection $collection)
{
$batchSize = 1000;
$batchData = [];
$processedRows = 0;
foreach ($collection as $key => $row) {
if ($key < 5 || !$row[1]) {
continue;
}
$requestArray = [
'c_moneda' => $row[0],
'descripcion' => $row[1],
'decimales' => $row[2],
'porcentaje_variacion' => $row[3],
'fecha_inicio_de_vigencia' => $row[4] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[4])) :
null,
'fecha_fin_de_vigencia' => $row[5] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[5])) :
null,
];
$batchData[] = $requestArray;
$processedRows++;
if (count($batchData) >= $batchSize) {
$this->insertBatch($batchData);
$batchData = [];
}
}
if (!empty($batchData)) {
$this->insertBatch($batchData);
}
echo "\n\033[32mImport completed: Processed $processedRows rows.\033[0m\n";
}
private function insertBatch(array $batchData)
{
try {
DB::table('sat_moneda')->upsert(
$batchData,
[
'c_moneda',
],
[
'descripcion',
'decimales',
'porcentaje_variacion',
'fecha_inicio_de_vigencia',
'fecha_fin_de_vigencia',
]
);
} catch (\Exception $e) {
echo "Error in batch: " . $e->getMessage() . "\n";
foreach ($batchData as $row) {
echo "Row data: " . json_encode($row) . "\n";
}
}
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace Modules\Admin\App\Imports;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\ToCollection;
class SATMunicipioImport implements ToCollection
{
/**
* @param Collection $collection
*/
public function collection(Collection $collection)
{
$batchSize = 1000;
$batchData = [];
$processedRows = 0;
foreach ($collection as $key => $row) {
if ($key < 5 || !$row[1]) {
continue;
}
$requestArray = [
'c_municipio' => $row[0],
'c_estado' => $row[1],
'descripcion' => $row[2],
'fecha_de_inicio_de_vigencia' => $row[3] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[3])) :
null,
'fecha_de_fin_de_vigencia' => $row[4] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[4])) :
null,
];
$batchData[] = $requestArray;
$processedRows++;
if (count($batchData) >= $batchSize) {
$this->insertBatch($batchData);
$batchData = [];
}
}
if (!empty($batchData)) {
$this->insertBatch($batchData);
}
echo "\n\033[32mImport completed: Processed $processedRows rows.\033[0m\n";
}
private function insertBatch(array $batchData)
{
try {
DB::table('sat_municipio')->upsert(
$batchData,
[
'c_municipio',
'c_estado',
],
[
'descripcion',
'fecha_de_inicio_de_vigencia',
'fecha_de_fin_de_vigencia'
]
);
} catch (\Exception $e) {
echo "Error in batch: " . $e->getMessage() . "\n";
foreach ($batchData as $row) {
echo "Row data: " . json_encode($row) . "\n";
}
}
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace Modules\Admin\App\Imports;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\ToCollection;
class SATPaisImport implements ToCollection
{
/**
* @param Collection $collection
*/
public function collection(Collection $collection)
{
$batchSize = 1000;
$batchData = [];
$processedRows = 0;
foreach ($collection as $key => $row) {
if ($key < 5 || !$row[1]) {
continue;
}
$requestArray = [
'c_pais' => $row[0],
'descripcion' => $row[1],
'formato_de_codigo_postal' => $row[2],
'formato_de_registro_de_identidad_tributaria' => $row[3],
'validacion_del_registro_de_identidad_tributaria' => $row[4],
'agrupaciones' => $row[5],
];
$batchData[] = $requestArray;
$processedRows++;
if (count($batchData) >= $batchSize) {
$this->insertBatch($batchData);
$batchData = [];
}
}
if (!empty($batchData)) {
$this->insertBatch($batchData);
}
echo "\n\033[32mImport completed: Processed $processedRows rows.\033[0m\n";
}
private function insertBatch(array $batchData)
{
try {
DB::table('sat_pais')->upsert(
$batchData,
[
'c_pais',
],
[
'descripcion',
'formato_de_codigo_postal',
'formato_de_registro_de_identidad_tributaria',
'validacion_del_registro_de_identidad_tributaria',
'agrupaciones',
]
);
} catch (\Exception $e) {
echo "Error in batch: " . $e->getMessage() . "\n";
foreach ($batchData as $row) {
echo "Row data: " . json_encode($row) . "\n";
}
}
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace Modules\Admin\App\Imports;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\ToCollection;
class SATRegimenFiscalImport implements ToCollection
{
/**
* @param Collection $collection
*/
public function collection(Collection $collection)
{
$batchSize = 1000;
$batchData = [];
$processedRows = 0;
foreach ($collection as $key => $row) {
if ($key < 6 || !$row[1]) {
continue;
}
$requestArray = [
'c_regimen_fiscal' => $row[0],
'descripcion' => $row[1],
'fisica' => $row[2],
'moral' => $row[3],
'fecha_de_inicio_de_vigencia' => $row[4] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[4])) :
null,
'fecha_de_fin_de_vigencia' => $row[5] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[5])) :
null,
];
$batchData[] = $requestArray;
$processedRows++;
if (count($batchData) >= $batchSize) {
$this->insertBatch($batchData);
$batchData = [];
}
}
if (!empty($batchData)) {
$this->insertBatch($batchData);
}
echo "\n\033[32mImport completed: Processed $processedRows rows.\033[0m\n";
}
private function insertBatch(array $batchData)
{
try {
DB::table('sat_regimen_fiscal')->upsert(
$batchData,
[
'c_regimen_fiscal',
],
[
'descripcion',
'fisica',
'moral',
'fecha_de_inicio_de_vigencia',
'fecha_de_fin_de_vigencia'
]
);
} catch (\Exception $e) {
echo "Error in batch: " . $e->getMessage() . "\n";
foreach ($batchData as $row) {
echo "Row data: " . json_encode($row) . "\n";
}
}
}
}

View File

@ -0,0 +1,81 @@
<?php
namespace Modules\Admin\App\Imports;
use Carbon\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Concerns\ToCollection;
class SATUsoCFDIImport implements ToCollection
{
/**
* @param Collection $collection
*/
public function collection(Collection $collection)
{
$batchSize = 1000;
$batchData = [];
$processedRows = 0;
foreach ($collection as $key => $row) {
if ($key < 6 || !$row[1]) {
continue;
}
$requestArray = [
'c_uso_cfdi' => $row[0],
'descripcion' => $row[1],
'aplica_para_tipo_persona_fisica' => $row[2],
'aplica_para_tipo_persona_moral' => $row[3],
'fecha_inicio_de_vigencia' => $row[4] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[4])) :
null,
'fecha_fin_de_vigencia' => $row[5] ?
Carbon::instance(\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($row[5])) :
null,
'regimen_fiscal_receptor' => $row[6],
];
$batchData[] = $requestArray;
$processedRows++;
if (count($batchData) >= $batchSize) {
$this->insertBatch($batchData);
$batchData = [];
}
}
if (!empty($batchData)) {
$this->insertBatch($batchData);
}
echo "\n\033[32mImport completed: Processed $processedRows rows.\033[0m\n";
}
private function insertBatch(array $batchData)
{
try {
DB::table('sat_uso_cfdi')->upsert(
$batchData,
[
'c_uso_cfdi',
],
[
'descripcion',
'aplica_para_tipo_persona_fisica',
'aplica_para_tipo_persona_moral',
'fecha_inicio_de_vigencia',
'fecha_fin_de_vigencia',
'regimen_fiscal_receptor',
]
);
} catch (\Exception $e) {
echo "Error in batch: " . $e->getMessage() . "\n";
foreach ($batchData as $row) {
echo "Row data: " . json_encode($row) . "\n";
}
}
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace Modules\Admin\App\Imports;
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
use Maatwebsite\Excel\Concerns\WithConditionalSheets;
class SatCatalogsImport implements WithMultipleSheets
{
use WithConditionalSheets;
public function conditionalSheets(): array
{
return [
'c_FormaPago' => new SATFormaPagoImport(),
'c_Moneda' => new SATMonedaImport(),
'c_CodigoPostal_Parte_1' => new SATCodigoPostalImport(),
'c_CodigoPostal_Parte_2' => new SATCodigoPostalImport(),
'c_RegimenFiscal' => new SATRegimenFiscalImport(),
'c_Pais' => new SATPaisImport(),
'c_UsoCFDI' => new SATUsoCFDIImport(),
'C_Colonia_1' => new SATColoniaImport(),
'C_Colonia_2' => new SATColoniaImport(),
'C_Colonia_3' => new SATColoniaImport(),
'c_Estado' => new SATEstadoImport(),
'C_Localidad' => new SATLocalidadImport(),
'C_Municipio' => new SATMunicipioImport(),
];
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Modules\Admin\App\Listeners;
use Illuminate\Auth\Events\Logout;
use Illuminate\Support\Facades\Log;
use Modules\Admin\App\Services\VuexyAdminService;
class ClearUserCache
{
/**
* Handle the event.
*
* @return void
*/
public function handle(Logout $event)
{
if ($event->user) {
VuexyAdminService::clearUserMenuCache();
VuexyAdminService::clearSearchMenuCache();
VuexyAdminService::clearQuickLinksCache();
VuexyAdminService::clearNotificationsCache();
}
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Modules\Admin\App\Listeners;
use Illuminate\Auth\Events\Login;
use Illuminate\Support\Facades\Mail;
use Modules\Admin\App\Models\UserLogin;
class HandleUserLogin
{
public function handle(Login $event)
{
// Guardar log en base de datos
UserLogin::create([
'user_id' => $event->user->id,
'ip_address' => request()->ip(),
'user_agent' => request()->header('User-Agent'),
]);
// Actualizar el último login
$event->user->update(['last_login_at' => now(), 'last_login_ip' => request()->ip()]);
// Enviar notificación de inicio de sesión
//Mail::to($event->user->email)->send(new LoginNotification($event->user));
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace Modules\Admin\App\Livewire\AdminSettings;
use Livewire\Component;
use Livewire\WithFileUploads;
use Modules\Admin\App\Services\AdminSettingsService;
use Modules\Admin\App\Services\AdminTemplateService;
class ApplicationSettings extends Component
{
use WithFileUploads;
private $targetNotify = "#application-settings-card .notification-container";
public $admin_app_name,
$admin_image_logo,
$admin_image_logo_dark;
public $upload_image_logo,
$upload_image_logo_dark;
public function mount()
{
$this->loadSettings();
}
public function loadSettings($clearcache = false)
{
$this->upload_image_logo = null;
$this->upload_image_logo_dark = null;
$adminTemplateService = app(AdminTemplateService::class);
if ($clearcache) {
$adminTemplateService->clearAdminVarsCache();
}
// Obtener los valores de las configuraciones de la base de datos
$settings = $adminTemplateService->getAdminVars();
$this->admin_app_name = $settings['app_name'];
$this->admin_image_logo = $settings['image_logo']['large'];
$this->admin_image_logo_dark = $settings['image_logo']['large_dark'];
}
public function save()
{
$this->validate([
'admin_app_name' => 'required|string|max:255',
'upload_image_logo' => 'nullable|image|mimes:jpeg,png,jpg,svg,webp|max:20480',
'upload_image_logo_dark' => 'nullable|image|mimes:jpeg,png,jpg,svg,webp|max:20480',
]);
$adminSettingsService = app(AdminSettingsService::class);
// Guardar título del App en configuraciones
$adminSettingsService->updateSetting('admin_app_name', $this->admin_app_name);
// Procesar favicon si se ha cargado una imagen
if ($this->upload_image_logo) {
$adminSettingsService->processAndSaveImageLogo($this->upload_image_logo);
}
if ($this->upload_image_logo_dark) {
$adminSettingsService->processAndSaveImageLogo($this->upload_image_logo_dark, 'dark');
}
$this->loadSettings(true);
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function render()
{
return view('admin::livewire.admin-settings.application-settings');
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace Modules\Admin\App\Livewire\AdminSettings;
use Livewire\Component;
use Livewire\WithFileUploads;
use Modules\Admin\App\Services\AdminSettingsService;
use Modules\Admin\App\Services\AdminTemplateService;
class GeneralSettings extends Component
{
use WithFileUploads;
private $targetNotify = "#general-settings-card .notification-container";
public $admin_title;
public $admin_favicon_16x16,
$admin_favicon_76x76,
$admin_favicon_120x120,
$admin_favicon_152x152,
$admin_favicon_180x180,
$admin_favicon_192x192;
public $upload_image_favicon;
public function mount()
{
$this->loadSettings();
}
public function loadSettings($clearcache = false)
{
$this->upload_image_favicon = null;
$adminTemplateService = app(AdminTemplateService::class);
if ($clearcache) {
$adminTemplateService->clearAdminVarsCache();
}
// Obtener los valores de las configuraciones de la base de datos
$settings = $adminTemplateService->getAdminVars();
$this->admin_title = $settings['title'];
$this->admin_favicon_16x16 = $settings['favicon']['16x16'];
$this->admin_favicon_76x76 = $settings['favicon']['76x76'];
$this->admin_favicon_120x120 = $settings['favicon']['120x120'];
$this->admin_favicon_152x152 = $settings['favicon']['152x152'];
$this->admin_favicon_180x180 = $settings['favicon']['180x180'];
$this->admin_favicon_192x192 = $settings['favicon']['192x192'];
}
public function save()
{
$this->validate([
'admin_title' => 'required|string|max:255',
'upload_image_favicon' => 'nullable|image|mimes:jpeg,png,jpg,svg,webp|max:20480',
]);
$adminSettingsService = app(AdminSettingsService::class);
// Guardar título del sitio en configuraciones
$adminSettingsService->updateSetting('admin_title', $this->admin_title);
// Procesar favicon si se ha cargado una imagen
if ($this->upload_image_favicon) {
$adminSettingsService->processAndSaveFavicon($this->upload_image_favicon);
}
$this->loadSettings(true);
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function render()
{
return view('admin::livewire.admin-settings.general-settings');
}
}

View File

@ -0,0 +1,118 @@
<?php
namespace Modules\Admin\App\Livewire\AdminSettings;
use Livewire\Component;
use Modules\Admin\App\Services\AdminTemplateService;
use Modules\Admin\App\Services\GlobalSettingsService;
class InterfaceSettings extends Component
{
private $targetNotify = "#interface-settings-card .notification-container";
public $vuexy_myLayout,
$vuexy_myTheme,
$vuexy_myStyle,
$vuexy_hasCustomizer,
$vuexy_displayCustomizer,
$vuexy_contentLayout,
$vuexy_navbarType,
$vuexy_footerFixed,
$vuexy_menuFixed,
$vuexy_menuCollapsed,
$vuexy_headerType,
$vuexy_showDropdownOnHover,
$vuexy_authViewMode,
$vuexy_maxQuickLinks;
public function mount()
{
$this->loadSettings();
}
public function loadSettings()
{
$adminTemplateService = app(AdminTemplateService::class);
// Obtener los valores de las configuraciones de la base de datos
$settings = $adminTemplateService->getVuexyCustomizerVars();
$this->vuexy_myLayout = $settings['myLayout'];
$this->vuexy_myTheme = $settings['myTheme'];
$this->vuexy_myStyle = $settings['myStyle'];
$this->vuexy_hasCustomizer = $settings['hasCustomizer'];
$this->vuexy_displayCustomizer = $settings['displayCustomizer'];
$this->vuexy_contentLayout = $settings['contentLayout'];
$this->vuexy_navbarType = $settings['navbarType'];
$this->vuexy_footerFixed = $settings['footerFixed'];
$this->vuexy_menuFixed = $settings['menuFixed'];
$this->vuexy_menuCollapsed = $settings['menuCollapsed'];
$this->vuexy_headerType = $settings['headerType'];
$this->vuexy_showDropdownOnHover = $settings['showDropdownOnHover'];
$this->vuexy_authViewMode = $settings['authViewMode'];
$this->vuexy_maxQuickLinks = $settings['maxQuickLinks'];
}
public function save()
{
$this->validate([
'vuexy_maxQuickLinks' => 'required|integer|min:2|max:20',
]);
$globalSettingsService = app(GlobalSettingsService::class);
// Guardar configuraciones
$globalSettingsService->updateSetting('config.custom.custom.myLayout', $this->vuexy_myLayout);
$globalSettingsService->updateSetting('config.custom.custom.myTheme', $this->vuexy_myTheme);
$globalSettingsService->updateSetting('config.custom.custom.myStyle', $this->vuexy_myStyle);
$globalSettingsService->updateSetting('config.custom.custom.hasCustomizer', $this->vuexy_hasCustomizer);
$globalSettingsService->updateSetting('config.custom.custom.displayCustomizer', $this->vuexy_displayCustomizer);
$globalSettingsService->updateSetting('config.custom.custom.contentLayout', $this->vuexy_contentLayout);
$globalSettingsService->updateSetting('config.custom.custom.navbarType', $this->vuexy_navbarType);
$globalSettingsService->updateSetting('config.custom.custom.footerFixed', $this->vuexy_footerFixed);
$globalSettingsService->updateSetting('config.custom.custom.menuFixed', $this->vuexy_menuFixed);
$globalSettingsService->updateSetting('config.custom.custom.menuCollapsed', $this->vuexy_menuCollapsed);
$globalSettingsService->updateSetting('config.custom.custom.headerType', $this->vuexy_headerType);
$globalSettingsService->updateSetting('config.custom.custom.showDropdownOnHover', $this->vuexy_showDropdownOnHover);
$globalSettingsService->updateSetting('config.custom.custom.authViewMode', $this->vuexy_authViewMode);
$globalSettingsService->updateSetting('config.custom.custom.maxQuickLinks', $this->vuexy_maxQuickLinks);
$globalSettingsService->clearSystemConfigCache();
// Refrescar el componente actual
$this->dispatch('clearLocalStoregeTemplateCustomizer');
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.',
deferReload: true
);
}
public function clearCustomConfig()
{
$globalSettingsService = app(GlobalSettingsService::class);
$globalSettingsService->clearVuexyCustomConfig();
// Refrescar el componente actual
$this->dispatch('clearLocalStoregeTemplateCustomizer');
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.',
deferReload: true
);
}
public function render()
{
return view('admin::livewire.admin-settings.interface-settings');
}
}

View File

@ -0,0 +1,106 @@
<?php
namespace Modules\Admin\App\Livewire\AdminSettings;
use Livewire\Component;
use Modules\Admin\App\Services\GlobalSettingsService;
class MailSenderResponseSettings extends Component
{
private $targetNotify = "#mail-sender-response-settings-card .notification-container";
public $from_address,
$from_name,
$reply_to_method,
$reply_to_email,
$reply_to_name;
protected $listeners = ['saveMailSenderResponseSettings' => 'save'];
const REPLY_EMAIL_CREATOR = 1;
const REPLY_EMAIL_SENDER = 2;
const REPLY_EMAIL_CUSTOM = 3;
public $reply_email_options = [
self::REPLY_EMAIL_CREATOR => 'Responder al creador del documento',
self::REPLY_EMAIL_SENDER => 'Responder a quien envía el documento',
self::REPLY_EMAIL_CUSTOM => 'Definir dirección de correo electrónico',
];
public function mount()
{
$this->loadSettings();
}
public function loadSettings()
{
$globalSettingsService = app(GlobalSettingsService::class);
// Obtener los valores de las configuraciones de la base de datos
$settings = $globalSettingsService->getMailSystemConfig();
$this->from_address = $settings['from']['address'];
$this->from_name = $settings['from']['name'];
$this->reply_to_method = $settings['reply_to']['method'];
$this->reply_to_email = $settings['reply_to']['email'];
$this->reply_to_name = $settings['reply_to']['name'];
}
public function save()
{
$this->validate([
'from_address' => 'required|email',
'from_name' => 'required|string|max:255',
'reply_to_method' => 'required|string|max:255',
], [
'from_address.required' => 'El campo de correo electrónico es obligatorio.',
'from_address.email' => 'El formato del correo electrónico no es válido.',
'from_name.required' => 'El nombre es obligatorio.',
'from_name.string' => 'El nombre debe ser una cadena de texto.',
'from_name.max' => 'El nombre no puede tener más de 255 caracteres.',
'reply_to_method.required' => 'El método de respuesta es obligatorio.',
'reply_to_method.string' => 'El método de respuesta debe ser una cadena de texto.',
'reply_to_method.max' => 'El método de respuesta no puede tener más de 255 caracteres.',
]);
if ($this->reply_to_method == self::REPLY_EMAIL_CUSTOM) {
$this->validate([
'reply_to_email' => ['required', 'email'],
'reply_to_name' => ['required', 'string', 'max:255'],
], [
'reply_to_email.required' => 'El correo de respuesta es obligatorio.',
'reply_to_email.email' => 'El formato del correo de respuesta no es válido.',
'reply_to_name.required' => 'El nombre de respuesta es obligatorio.',
'reply_to_name.string' => 'El nombre de respuesta debe ser una cadena de texto.',
'reply_to_name.max' => 'El nombre de respuesta no puede tener más de 255 caracteres.',
]);
}
$globalSettingsService = app(GlobalSettingsService::class);
// Guardar título del App en configuraciones
$globalSettingsService->updateSetting('mail.from.address', $this->from_address);
$globalSettingsService->updateSetting('mail.from.name', $this->from_name);
$globalSettingsService->updateSetting('mail.reply_to.method', $this->reply_to_method);
$globalSettingsService->updateSetting('mail.reply_to.email', $this->reply_to_method == self::REPLY_EMAIL_CUSTOM ? $this->reply_to_email : '');
$globalSettingsService->updateSetting('mail.reply_to.name', $this->reply_to_method == self::REPLY_EMAIL_CUSTOM ? $this->reply_to_name : '');
$globalSettingsService->clearMailSystemConfigCache();
$this->loadSettings();
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.',
);
}
public function render()
{
return view('admin::livewire.admin-settings.mail-sender-response-settings');
}
}

View File

@ -0,0 +1,175 @@
<?php
namespace Modules\Admin\App\Livewire\AdminSettings;
use Livewire\Component;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Crypt;
use Symfony\Component\Mailer\Transport;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mime\Email;
use Modules\Admin\App\Services\GlobalSettingsService;
class MailSmtpSettings extends Component
{
private $targetNotify = "#mail-smtp-settings-card .notification-container";
public $change_smtp_settings,
$host,
$port,
$encryption,
$username,
$password;
public $save_button_disabled;
protected $listeners = [
'loadSettings',
'testSmtpConnection',
];
// the list of smtp_encryption values that can be stored in table
const SMTP_ENCRYPTION_SSL = 'SSL';
const SMTP_ENCRYPTION_TLS = 'TLS';
const SMTP_ENCRYPTION_NONE = 'none';
public $encryption_options = [
self::SMTP_ENCRYPTION_SSL => 'SSL (Secure Sockets Layer)',
self::SMTP_ENCRYPTION_TLS => 'TLS (Transport Layer Security)',
self::SMTP_ENCRYPTION_NONE => 'Sin encriptación (No recomendado)',
];
public $rules = [
[
'host' => 'nullable|string|max:255',
'port' => 'nullable|integer',
'encryption' => 'nullable|string',
'username' => 'nullable|string|max:255',
'password' => 'nullable|string|max:255',
],
[
'host.string' => 'El servidor SMTP debe ser una cadena de texto.',
'host.max' => 'El servidor SMTP no puede exceder los 255 caracteres.',
'port.integer' => 'El puerto SMTP debe ser un número entero.',
'encryption.string' => 'El tipo de encriptación SMTP debe ser una cadena de texto.',
'username.string' => 'El nombre de usuario SMTP debe ser una cadena de texto.',
'username.max' => 'El nombre de usuario SMTP no puede exceder los 255 caracteres.',
'password.string' => 'La contraseña SMTP debe ser una cadena de texto.',
'password.max' => 'La contraseña SMTP no puede exceder los 255 caracteres.',
]
];
public function mount()
{
$this->loadSettings();
}
public function loadSettings()
{
$globalSettingsService = app(GlobalSettingsService::class);
// Obtener los valores de las configuraciones de la base de datos
$settings = $globalSettingsService->getMailSystemConfig();
$this->change_smtp_settings = false;
$this->save_button_disabled = true;
$this->host = $settings['mailers']['smtp']['host'];
$this->port = $settings['mailers']['smtp']['port'];
$this->encryption = $settings['mailers']['smtp']['encryption'];
$this->username = $settings['mailers']['smtp']['username'];
$this->password = null;
}
public function save()
{
$this->validate($this->rules[0]);
$globalSettingsService = app(GlobalSettingsService::class);
// Guardar título del App en configuraciones
$globalSettingsService->updateSetting('mail.mailers.smtp.host', $this->host);
$globalSettingsService->updateSetting('mail.mailers.smtp.port', $this->port);
$globalSettingsService->updateSetting('mail.mailers.smtp.encryption', $this->encryption);
$globalSettingsService->updateSetting('mail.mailers.smtp.username', $this->username);
$globalSettingsService->updateSetting('mail.mailers.smtp.password', Crypt::encryptString($this->password));
$globalSettingsService->clearMailSystemConfigCache();
$this->loadSettings();
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function testSmtpConnection()
{
// Validar los datos del formulario
$this->validate($this->rules[0]);
try {
// Verificar la conexión SMTP
if ($this->validateSMTPConnection()) {
$this->save_button_disabled = false;
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Conexión SMTP exitosa, se guardó los cambios exitosamente.',
);
}
} catch (\Exception $e) {
// Captura y maneja errores de conexión SMTP
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'danger',
message: 'Error en la conexión SMTP: ' . $e->getMessage(),
notificationTimeout: 15000 // Timeout personalizado
);
}
}
private function validateSMTPConnection()
{
$dsn = sprintf(
'smtp://%s:%s@%s:%s?encryption=%s',
urlencode($this->username), // Codificar nombre de usuario
urlencode($this->password), // Codificar contraseña
$this->host, // Host SMTP
$this->port, // Puerto SMTP
$this->encryption // Encriptación (tls o ssl)
);
// Crear el transportador usando el DSN
$transport = Transport::fromDsn($dsn);
// Crear el mailer con el transportador personalizado
$mailer = new Mailer($transport);
// Enviar un correo de prueba
$email = (new Email())
->from($this->username) // Dirección de correo del remitente
->to(env('MAIL_SANDBOX')) // Dirección de correo de destino
->subject(Config::get('app.name') . ' - Correo de prueba')
->text('Este es un correo de prueba para verificar la conexión SMTP.');
// Enviar el correo
$mailer->send($email);
return true;
}
public function render()
{
return view('admin::livewire.admin-settings.mail-smtp-settings');
}
}

View File

@ -0,0 +1,212 @@
<?php
namespace Modules\Admin\App\Livewire\Cache;
use Livewire\Component;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Redis;
class CacheFunctions extends Component
{
private $targetNotify = "#cache-functions-card .notification-container";
public $cacheCounts = [
'general' => 0,
'config' => 0,
'routes' => 0,
'views' => 0,
'events' => 0,
];
protected $listeners = [
'reloadCacheFunctionsStatsEvent' => 'reloadCacheStats',
];
public function mount()
{
$this->reloadCacheStats(false);
}
public function reloadCacheStats($notify = true)
{
$cacheDriver = config('cache.default'); // Obtiene el driver configurado para caché
// Caché General
switch ($cacheDriver) {
case 'memcached':
try {
$cacheStore = Cache::getStore()->getMemcached();
$stats = $cacheStore->getStats();
$this->cacheCounts['general'] = array_sum(array_column($stats, 'curr_items')); // Total de claves en Memcached
} catch (\Exception $e) {
$this->cacheCounts['general'] = 'Error obteniendo datos de Memcached';
}
break;
case 'redis':
try {
$prefix = config('cache.prefix'); // Asegúrate de agregar el sufijo correcto si es necesario
$keys = Redis::connection('cache')->keys($prefix . '*');
$this->cacheCounts['general'] = count($keys); // Total de claves en Redis
} catch (\Exception $e) {
$this->cacheCounts['general'] = 'Error obteniendo datos de Redis';
}
break;
case 'database':
try {
$this->cacheCounts['general'] = DB::table('cache')->count(); // Total de registros en la tabla de caché
} catch (\Exception $e) {
$this->cacheCounts['general'] = 'Error obteniendo datos de la base de datos';
}
break;
case 'file':
try {
$cachePath = config('cache.stores.file.path');
$files = glob($cachePath . '/*');
$this->cacheCounts['general'] = count($files);
} catch (\Exception $e) {
$this->cacheCounts['general'] = 'Error obteniendo datos de archivos';
}
break;
default:
$this->cacheCounts['general'] = 'Driver de caché no soportado';
}
// Configuración
$this->cacheCounts['config'] = file_exists(base_path('bootstrap/cache/config.php')) ? 1 : 0;
// Rutas
$this->cacheCounts['routes'] = count(glob(base_path('bootstrap/cache/routes-*.php'))) > 0 ? 1 : 0;
// Vistas
$this->cacheCounts['views'] = count(glob(storage_path('framework/views/*')));
// Configuración
$this->cacheCounts['events'] = file_exists(base_path('bootstrap/cache/events.php')) ? 1 : 0;
if ($notify) {
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han recargado los estadísticos de caché.'
);
}
}
public function clearLaravelCache()
{
Artisan::call('cache:clear');
sleep(1);
$this->response('Se han limpiado las cachés de la aplicación.', 'warning');
}
public function clearConfigCache()
{
Artisan::call('config:clear');
$this->response('Se ha limpiado la cache de la configuración de Laravel.', 'warning');
}
public function configCache()
{
Artisan::call('config:cache');
}
public function clearRouteCache()
{
Artisan::call('route:clear');
$this->response('Se han limpiado las rutas de Laravel.', 'warning');
}
public function cacheRoutes()
{
Artisan::call('route:cache');
}
public function clearViewCache()
{
Artisan::call('view:clear');
$this->response('Se han limpiado las vistas de Laravel.', 'warning');
}
public function cacheViews()
{
Artisan::call('view:cache');
$this->response('Se han cacheado las vistas de Laravel.');
}
public function clearEventCache()
{
Artisan::call('event:clear');
$this->response('Se han limpiado los eventos de Laravel.', 'warning');
}
public function cacheEvents()
{
Artisan::call('event:cache');
$this->response('Se han cacheado los eventos de Laravel.');
}
public function optimizeClear()
{
Artisan::call('optimize:clear');
$this->response('Se han optimizado todos los cachés de Laravel.');
}
public function resetPermissionCache()
{
Artisan::call('permission:cache-reset');
$this->response('Se han limpiado los cachés de permisos.', 'warning');
}
public function clearResetTokens()
{
Artisan::call('auth:clear-resets');
$this->response('Se han limpiado los tokens de reseteo de contraseña.', 'warning');
}
/**
* Genera una respuesta estandarizada.
*/
private function response(string $message, string $type = 'success'): void
{
$this->reloadCacheStats(false);
$this->dispatch(
'notification',
target: $this->targetNotify,
type: $type,
message: $message,
);
$this->dispatch('reloadCacheStatsEvent', notify: false);
$this->dispatch('reloadSessionStatsEvent', notify: false);
$this->dispatch('reloadRedisStatsEvent', notify: false);
$this->dispatch('reloadMemcachedStatsEvent', notify: false);
}
public function render()
{
return view('admin::livewire.cache.cache-functions');
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace Modules\Admin\App\Livewire\Cache;
use Livewire\Component;
use Modules\Admin\App\Services\CacheConfigService;
use Modules\Admin\App\Services\CacheManagerService;
class CacheStats extends Component
{
private $targetNotify = "#cache-stats-card .notification-container";
public $cacheConfig = [];
public $cacheStats = [];
protected $listeners = ['reloadCacheStatsEvent' => 'reloadCacheStats'];
public function mount(CacheConfigService $cacheConfigService)
{
$this->cacheConfig = $cacheConfigService->getConfig();
$this->reloadCacheStats(false);
}
public function reloadCacheStats($notify = true)
{
$cacheManagerService = new CacheManagerService();
$this->cacheStats = $cacheManagerService->getCacheStats();
if ($notify) {
$this->dispatch(
'notification',
target: $this->targetNotify,
type: $this->cacheStats['status'],
message: $this->cacheStats['message']
);
}
}
public function clearCache()
{
$cacheManagerService = new CacheManagerService();
$message = $cacheManagerService->clearCache();
$this->reloadCacheStats(false);
$this->dispatch(
'notification',
target: $this->targetNotify,
type: $message['status'],
message: $message['message'],
);
$this->dispatch('reloadRedisStatsEvent', notify: false);
$this->dispatch('reloadMemcachedStatsEvent', notify: false);
$this->dispatch('reloadCacheFunctionsStatsEvent', notify: false);
}
public function render()
{
return view('admin::livewire.cache.cache-stats');
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace Modules\Admin\App\Livewire\Cache;
use Livewire\Component;
use Modules\Admin\App\Services\CacheManagerService;
class MemcachedStats extends Component
{
private $driver = 'memcached';
private $targetNotify = "#memcached-stats-card .notification-container";
public $memcachedStats = [];
protected $listeners = ['reloadMemcachedStatsEvent' => 'reloadCacheStats'];
public function mount()
{
$this->reloadCacheStats(false);
}
public function reloadCacheStats($notify = true)
{
$cacheManagerService = new CacheManagerService($this->driver);
$memcachedStats = $cacheManagerService->getMemcachedStats();
$this->memcachedStats = $memcachedStats['info'];
if ($notify) {
$this->dispatch(
'notification',
target: $this->targetNotify,
type: $memcachedStats['status'],
message: $memcachedStats['message']
);
}
}
public function clearCache()
{
$cacheManagerService = new CacheManagerService($this->driver);
$message = $cacheManagerService->clearCache();
$this->reloadCacheStats(false);
$this->dispatch(
'notification',
target: $this->targetNotify,
type: $message['status'],
message: $message['message'],
);
$this->dispatch('reloadCacheStatsEvent', notify: false);
$this->dispatch('reloadSessionStatsEvent', notify: false);
$this->dispatch('reloadCacheFunctionsStatsEvent', notify: false);
}
public function render()
{
return view('admin::livewire.cache.memcached-stats');
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace Modules\Admin\App\Livewire\Cache;
use Livewire\Component;
use Modules\Admin\App\Services\CacheManagerService;
class RedisStats extends Component
{
private $driver = 'redis';
private $targetNotify = "#redis-stats-card .notification-container";
public $redisStats = [];
protected $listeners = ['reloadRedisStatsEvent' => 'reloadCacheStats'];
public function mount()
{
$this->reloadCacheStats(false);
}
public function reloadCacheStats($notify = true)
{
$cacheManagerService = new CacheManagerService($this->driver);
$redisStats = $cacheManagerService->getRedisStats();
$this->redisStats = $redisStats['info'];
if ($notify) {
$this->dispatch(
'notification',
target: $this->targetNotify,
type: $redisStats['status'],
message: $redisStats['message']
);
}
}
public function clearCache()
{
$cacheManagerService = new CacheManagerService($this->driver);
$message = $cacheManagerService->clearCache();
$this->reloadCacheStats(false);
$this->dispatch(
'notification',
target: $this->targetNotify,
type: $message['status'],
message: $message['message'],
);
$this->dispatch('reloadCacheStatsEvent', notify: false);
$this->dispatch('reloadSessionStatsEvent', notify: false);
$this->dispatch('reloadCacheFunctionsStatsEvent', notify: false);
}
public function render()
{
return view('admin::livewire.cache.redis-stats');
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace Modules\Admin\App\Livewire\Cache;
use Livewire\Component;
use Modules\Admin\App\Services\CacheConfigService;
use Modules\Admin\App\Services\SessionManagerService;
class SessionStats extends Component
{
private $targetNotify = "#session-stats-card .notification-container";
public $cacheConfig = [];
public $sessionStats = [];
protected $listeners = ['reloadSessionStatsEvent' => 'reloadSessionStats'];
public function mount(CacheConfigService $cacheConfigService)
{
$this->cacheConfig = $cacheConfigService->getConfig();
$this->reloadSessionStats(false);
}
public function reloadSessionStats($notify = true)
{
$sessionManagerService = new SessionManagerService();
$this->sessionStats = $sessionManagerService->getSessionStats();
if ($notify) {
$this->dispatch(
'notification',
target: $this->targetNotify,
type: $this->sessionStats['status'],
message: $this->sessionStats['message']
);
}
}
public function clearSessions()
{
$sessionManagerService = new SessionManagerService();
$message = $sessionManagerService->clearSessions();
$this->reloadSessionStats(false);
$this->dispatch(
'notification',
target: $this->targetNotify,
type: $message['status'],
message: $message['message'],
);
$this->dispatch('reloadRedisStatsEvent', notify: false);
$this->dispatch('reloadMemcachedStatsEvent', notify: false);
}
public function render()
{
return view('admin::livewire.cache.session-stats');
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace Modules\Admin\App\Livewire\Rbac;
use Spatie\Permission\Models\Role;
use Livewire\Component;
class PermissionsIndex extends Component
{
public $roles_html_select;
public $rows_roles;
public function render()
{
// Generamos Select y estilos HTML de roles
$this->roles_html_select = "<select id=\"UserRole\" class=\"form-select text-capitalize\"><option value=\"\"> Selecciona un rol </option>";
foreach (Role::all() as $role) {
$this->rows_roles[$role->name] = "<span class=\"badge bg-label-{$role->style} m-1\">{$role->name}</span>";
$this->roles_html_select .= "<option value=\"{$role->name}\" class=\"text-capitalize\">{$role->name}</option>";
}
$this->roles_html_select .= "</select>";
return view('admin::livewire.rbac.permissions-index');
}
}

View File

@ -0,0 +1,182 @@
<?php
namespace Modules\Admin\App\Livewire\Rbac;
use Illuminate\Support\Facades\Auth;
use Spatie\Permission\Models\Permission;
use Spatie\Permission\Models\Role;
use Livewire\Component;
class RoleCards extends Component
{
public $roles = [];
public $permissions = [];
public $roleId;
public $name;
public $style;
public $title;
public $btn_submit_text;
public $permissionsInputs = [];
public $destroyRoleId;
protected $listeners = ['saveRole', 'deleteRole'];
public function mount()
{
$this->loadRolesAndPermissions();
$this->dispatch('reloadForm');
}
private function loadRolesAndPermissions()
{
$this->roles = Auth::user()->hasRole('SuperAdmin') ?
Role::all() :
Role::where('name', '!=', 'SuperAdmin')->get();
// Obtener todos los permisos
$permissions = Permission::all()->map(function ($permission) {
$name = $permission->name;
$action = substr($name, strrpos($name, '.') + 1);
return [
'group_name' => $permission->group_name,
'sub_group_name' => $permission->sub_group_name,
$action => $name // Agregar la acción directamente al array
];
})->groupBy('group_name'); // Agrupar los permisos por grupo
// Procesar los permisos agrupados para cargarlos en el componente
$permissionsInputs = [];
$this->permissions = $permissions->map(function ($groupPermissions) use (&$permissionsInputs) {
$permission = [
'group_name' => $groupPermissions[0]['group_name'], // Tomar el grupo del primer permiso del grupo
'sub_group_name' => $groupPermissions[0]['sub_group_name'], // Tomar la descripción del primer permiso del grupo
];
// Agregar todas las acciones al permissionsInputs y al permission
foreach ($groupPermissions as $permissionData) {
foreach ($permissionData as $key => $value) {
if ($key !== 'sub_group_name' && $key !== 'group_name') {
$permissionsInputs[str_replace('.', '_', $value)] = false;
$permission[$key] = $value;
}
}
}
return $permission;
});
$this->permissionsInputs = $permissionsInputs;
}
public function loadRoleData($action, $roleId = false)
{
$this->resetForm();
$this->title = 'Agregar un nuevo rol';
$this->btn_submit_text = 'Crear nuevo rol';
if ($roleId) {
$role = Role::findOrFail($roleId);
switch ($action) {
case 'view':
$this->title = $role->name;
$this->name = $role->name;
$this->style = $role->style;
$this->dispatch('deshabilitarFormulario');
break;
case 'update':
$this->title = 'Editar rol';
$this->btn_submit_text = 'Guardar cambios';
$this->roleId = $roleId;
$this->name = $role->name;
$this->style = $role->style;
$this->dispatch('habilitarFormulario');
break;
case 'clone':
$this->style = $role->style;
$this->dispatch('habilitarFormulario');
break;
default:
break;
}
foreach ($role->permissions as $permission) {
$this->permissionsInputs[str_replace('.', '_', $permission->name)] = true;
}
}
$this->dispatch('reloadForm');
}
public function loadDestroyRoleData() {}
public function saveRole()
{
$permissions = [];
foreach ($this->permissionsInputs as $permission => $value) {
if ($value === true)
$permissions[] = str_replace('_', '.', $permission);
}
if ($this->roleId) {
$role = Role::find($this->roleId);
$role->name = $this->name;
$role->style = $this->style;
$role->save();
$role->syncPermissions($permissions);
} else {
$role = Role::create([
'name' => $this->name,
'style' => $this->style,
]);
$role->syncPermissions($permissions);
}
$this->loadRolesAndPermissions();
$this->dispatch('modalHide');
$this->dispatch('reloadForm');
}
public function deleteRole()
{
$role = Role::find($this->destroyRoleId);
if ($role)
$role->delete();
$this->loadRolesAndPermissions();
$this->dispatch('modalDeleteHide');
$this->dispatch('reloadForm');
}
private function resetForm()
{
$this->roleId = '';
$this->name = '';
$this->style = '';
foreach ($this->permissionsInputs as $key => $permission) {
$this->permissionsInputs[$key] = false;
}
}
public function render()
{
return view('admin::livewire.rbac.role-cards');
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace Modules\Admin\App\Livewire\Users;
use Modules\Admin\App\Models\User;
use Livewire\Component;
class UserCount extends Component
{
public $total, $enabled, $disabled;
protected $listeners = ['refreshUserCount' => 'updateCounts'];
public function mount()
{
$this->updateCounts();
}
public function updateCounts()
{
$this->total = User::count();
$this->enabled = User::where('status', User::STATUS_ENABLED)->count();
$this->disabled = User::where('status', User::STATUS_DISABLED)->count();
}
public function render()
{
return view('admin::livewire.users.user-count');
}
}

View File

@ -0,0 +1,115 @@
<?php
namespace Modules\Admin\App\Livewire\Users;
use Spatie\Permission\Models\Role;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage;
use Modules\Admin\App\Models\User;
use Livewire\Component;
class UserTable extends Component
{
public $statuses;
public $status_options;
public $rows_roles = [];
public $roles_options = [];
public $roles_html_select;
public $total, $enabled, $disabled;
public $indexAlert;
public $userId, $name, $email, $password, $roles, $status, $photo, $src_photo;
public $modalTitle;
public $btnSubmitTxt;
public function mount()
{
$this->modalTitle = 'Crear usuario nuevo';
$this->btnSubmitTxt = 'Crear usuario';
$this->statuses = [
User::STATUS_ENABLED => ['title' => 'Activo', 'class' => 'badge bg-label-' . User::$statusListClass[User::STATUS_ENABLED]],
User::STATUS_DISABLED => ['title' => 'Deshabilitado', 'class' => 'badge bg-label-' . User::$statusListClass[User::STATUS_DISABLED]],
User::STATUS_REMOVED => ['title' => 'Eliminado', 'class' => 'badge bg-label-' . User::$statusListClass[User::STATUS_REMOVED]],
];
$roles = Role::whereNotIn('name', ['Patient', 'Doctor'])->get();
$this->roles_html_select = "<select id=\"UserRole\" class=\"form-select text-capitalize\"><option value=\"\"> Selecciona un rol </option>";
foreach ($roles as $role) {
$this->rows_roles[$role->name] = "<span class=\"badge bg-label-" . $role->style . " mx-1\">" . $role->name . "</span>";
if (Auth::user()->hasRole('SuperAdmin') || $role->name != 'SuperAdmin') {
$this->roles_html_select .= "<option value=\"" . $role->name . "\" class=\"text-capitalize\">" . $role->name . "</option>";
$this->roles_options[$role->name] = $role->name;
}
}
$this->roles_html_select .= "</select>";
$this->status_options = [
User::STATUS_ENABLED => User::$statusList[User::STATUS_ENABLED],
User::STATUS_DISABLED => User::$statusList[User::STATUS_DISABLED],
];
}
public function countUsers()
{
$this->total = User::count();
$this->enabled = User::where('status', User::STATUS_ENABLED)->count();
$this->disabled = User::where('status', User::STATUS_DISABLED)->count();
}
public function edit($id)
{
$user = User::findOrFail($id);
$this->indexAlert = '';
$this->modalTitle = 'Editar usuario: ' . $id;
$this->btnSubmitTxt = 'Guardar cambios';
$this->userId = $user->id;
$this->name = $user->name;
$this->email = $user->email;
$this->password = '';
$this->roles = $user->roles->pluck('name')->toArray();
$this->src_photo = $user->profile_photo_url;
$this->status = $user->status;
$this->dispatch('openModal');
}
public function delete($id)
{
$user = User::find($id);
if ($user) {
// Eliminar la imagen de perfil si existe
if ($user->profile_photo_path)
Storage::disk('public')->delete($user->profile_photo_path);
// Eliminar el usuario
$user->delete();
$this->indexAlert = '<div class="alert alert-warning alert-dismissible" role="alert">Se eliminó correctamente el usuario.<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button></div>';
$this->dispatch('refreshUserCount');
$this->dispatch('afterDelete');
} else {
$this->indexAlert = '<div class="alert alert-danger alert-dismissible" role="alert">Usuario no encontrado.<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button></div>';
}
}
public function render()
{
return view('admin::livewire.users.user-table', [
'users' => User::paginate(10),
]);
}
}

Some files were not shown because too many files have changed in this diff Show More