feat(cms): implement complete SysSiteCMS content management system

Initial implementation of the HomeSysPanel CMS built with Laravel 13.0.
Includes complete admin panel, content management, user authentication,
modular architecture for products/services/chatbot, and marketing tools.

Key features:
- User authentication with email verification and password reset
- Role-based access control (Admin/User with granular permissions)
- Content management (pages, news, FAQ, downloads, galleries, banners)
- Contact management system with subjects and responses
- Marketing tools (email campaigns, visitor analytics, social sharing)
- Modular architecture (Products, Services, Chatbot modules)
- AI Chatbot integration with OpenRouter.ai and LlamaCpp support
- Visitor tracking with geolocation
- SEO optimization with meta tags and Open Graph
- Responsive design with Bootstrap 5
- Dark mode support
- Maintenance mode
- Feature request system
This commit is contained in:
marco
2026-09-07 19:06:53 -03:00
commit 38295e7e88
279 changed files with 33691 additions and 0 deletions
+116
View File
@@ -0,0 +1,116 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rule;
use App\Models\Setting;
use Illuminate\Support\Facades\Storage;
class ProfileController extends Controller
{
/**
* Show the form for editing the user profile.
*/
public function edit()
{
$user = Auth::user();
return view('profile.edit', compact('user'));
}
/**
* Update the user profile.
*/
public function update(Request $request)
{
/** @var \App\Models\User $user */
$user = Auth::user();
$request->validate([
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', Rule::unique('users')->ignore($user->id)],
'avatar' => ['nullable', 'image', 'max:2048', 'mimes:jpeg,png,jpg,gif,webp'], // Max 2MB
'company' => ['nullable', 'string', 'max:255'],
'website' => ['nullable', 'url', 'max:255'],
'whatsapp' => ['nullable', 'string', 'max:20', 'regex:/^[\d\s\(\)\+\-]{10,20}$/'],
'password' => ['nullable', 'string', 'min:8', 'confirmed'],
], [
'avatar.mimes' => 'O avatar deve ser do tipo: JPEG, PNG, JPG, GIF ou WebP.',
'website.url' => 'O formato do site é inválido.',
'whatsapp.regex' => 'O formato do WhatsApp é inválido.',
]);
$data = $request->except(['password', 'avatar']);
if ($request->filled('password')) {
$data['password'] = Hash::make($request->password);
}
if ($request->hasFile('avatar')) {
// Remove avatar antigo se existir
if ($user->avatar) {
Storage::disk('public')->delete($user->avatar);
}
$data['avatar'] = $request->file('avatar')->store('avatars', 'public');
}
$user->update($data);
return redirect()->route('profile.edit')->with('success', 'Perfil atualizado com sucesso!');
}
/**
* Show user preferences.
*/
public function preferences()
{
$user = Auth::user();
$preferences = $user->preferences ?? [
'notifications_email' => true,
'notifications_system' => true,
'notifications_new_users' => true,
'notifications_page_actions' => true,
'notifications_gallery_actions' => true,
'notifications_product_actions' => true,
'theme' => 'light'
];
return view('profile.preferences', compact('user', 'preferences'));
}
/**
* Update user preferences.
*/
public function updatePreferences(Request $request)
{
/** @var \App\Models\User $user */
$user = Auth::user();
$user->update([
'preferences' => [
'notifications_email' => $request->has('notifications_email'),
'notifications_system' => $request->has('notifications_system'),
'notifications_new_users' => $request->has('notifications_new_users'),
'notifications_page_actions' => $request->has('notifications_page_actions'),
'notifications_gallery_actions' => $request->has('notifications_gallery_actions'),
'notifications_product_actions' => $request->has('notifications_product_actions'),
'theme' => $request->theme ?? 'light'
]
]);
if ($user->user_type === 'Admin') {
Setting::set('site_maintenance', $request->has('site_maintenance') ? 'on' : 'off', 'general');
Setting::set('whatsapp_floating_button', $request->has('whatsapp_floating_button') ? 'on' : 'off', 'general');
Setting::set('public_registration', $request->has('public_registration') ? 'on' : 'off', 'general');
// Salvar configurações de horário do WhatsApp
Setting::set('whatsapp_start_time', $request->whatsapp_start_time ?? '08:00', 'general');
Setting::set('whatsapp_end_time', $request->whatsapp_end_time ?? '18:00', 'general');
Setting::set('whatsapp_lunch_start', $request->whatsapp_lunch_start, 'general');
Setting::set('whatsapp_lunch_end', $request->whatsapp_lunch_end, 'general');
}
return redirect()->route('profile.preferences')->with('success', 'Preferências atualizadas com sucesso!');
}
}