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:
+89
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Banner;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class BannerController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$banners = Banner::orderBy('order')->paginate(10);
|
||||
return view('admin.banners.index', compact('banners'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return view('admin.banners.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'title' => 'required|string|max:255',
|
||||
'image' => 'required|image|max:2048|mimes:jpeg,png,jpg,gif,webp',
|
||||
'link' => 'nullable|string|max:500|regex:/^https?:\/\/.+\..+$/i',
|
||||
'button_text' => 'nullable|string|max:50',
|
||||
'order' => 'required|integer',
|
||||
'active' => 'required|boolean',
|
||||
], [
|
||||
'image.mimes' => 'A imagem deve ser do tipo: JPEG, PNG, JPG, GIF ou WebP.',
|
||||
'link.regex' => 'O link deve começar com http:// ou https:// e ter um formato válido.',
|
||||
]);
|
||||
|
||||
$data = $request->all();
|
||||
|
||||
if ($request->hasFile('image')) {
|
||||
$data['image'] = $request->file('image')->store('banners', 'public');
|
||||
}
|
||||
|
||||
Banner::create($data);
|
||||
|
||||
return redirect()->route('admin.marketing.banners.index')->with('success', 'Banner criado com sucesso.');
|
||||
}
|
||||
|
||||
public function edit(Banner $banner)
|
||||
{
|
||||
return view('admin.banners.edit', compact('banner'));
|
||||
}
|
||||
|
||||
public function update(Request $request, Banner $banner)
|
||||
{
|
||||
$request->validate([
|
||||
'title' => 'required|string|max:255',
|
||||
'image' => 'nullable|image|max:2048|mimes:jpeg,png,jpg,gif,webp',
|
||||
'link' => 'nullable|string|max:500|regex:/^https?:\/\/.+\..+$/i',
|
||||
'button_text' => 'nullable|string|max:50',
|
||||
'order' => 'required|integer',
|
||||
'active' => 'required|boolean',
|
||||
], [
|
||||
'image.mimes' => 'A imagem deve ser do tipo: JPEG, PNG, JPG, GIF ou WebP.',
|
||||
'link.regex' => 'O link deve começar com http:// ou https:// e ter um formato válido.',
|
||||
]);
|
||||
|
||||
$data = $request->all();
|
||||
|
||||
if ($request->hasFile('image')) {
|
||||
if ($banner->image) {
|
||||
Storage::disk('public')->delete($banner->image);
|
||||
}
|
||||
$data['image'] = $request->file('image')->store('banners', 'public');
|
||||
}
|
||||
|
||||
$banner->update($data);
|
||||
|
||||
return redirect()->route('admin.marketing.banners.index')->with('success', 'Banner atualizado com sucesso.');
|
||||
}
|
||||
|
||||
public function destroy(Banner $banner)
|
||||
{
|
||||
if ($banner->image) {
|
||||
Storage::disk('public')->delete($banner->image);
|
||||
}
|
||||
$banner->delete();
|
||||
return redirect()->route('admin.marketing.banners.index')->with('success', 'Banner excluído com sucesso.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user