File Manager Lite
Dir:
/home/codewavebd/public_html/app/Http/Controllers/Admin
Upload
[..]
AdminChatController.php (2.01 KB)
Edit
Rename
Del
AuthController.php (2.51 KB)
Edit
Rename
Del
BlogPostController.php (3.65 KB)
Edit
Rename
Del
CategoryController.php (2.33 KB)
Edit
Rename
Del
DashboardController.php (1.79 KB)
Edit
Rename
Del
FaqController.php (1.92 KB)
Edit
Rename
Del
LeadController.php (4.11 KB)
Edit
Rename
Del
MediaController.php (3.71 KB)
Edit
Rename
Del
PortfolioProjectController.php (5.15 KB)
Edit
Rename
Del
ServiceController.php (3.17 KB)
Edit
Rename
Del
SettingController.php (3.69 KB)
Edit
Rename
Del
SoftwareProductController.php (7.53 KB)
Edit
Rename
Del
TeamMemberController.php (2.56 KB)
Edit
Rename
Del
TestimonialController.php (2.05 KB)
Edit
Rename
Del
TwoFactorController.php (2.28 KB)
Edit
Rename
Del
Edit: TestimonialController.php
<?php namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Models\Testimonial; use App\Models\ActivityLog; use Illuminate\Http\Request; class TestimonialController extends Controller { public function index() { $testimonials = Testimonial::paginate(10); return view('admin.testimonials.index', compact('testimonials')); } public function store(Request $request) { $request->validate([ 'client_name' => 'required|string|max:100', 'client_role' => 'nullable|string|max:100', 'company_name' => 'nullable|string|max:100', 'review' => 'required|string|max:1000', 'rating' => 'required|integer|min:1|max:5', 'image' => 'nullable|string', 'status' => 'required|in:active,inactive', ]); $testimonial = Testimonial::create($request->all()); ActivityLog::log("Created testimonial from client: {$testimonial->client_name}"); return back()->with('success', 'Testimonial created successfully.'); } public function update(Request $request, Testimonial $testimonial) { $request->validate([ 'client_name' => 'required|string|max:100', 'client_role' => 'nullable|string|max:100', 'company_name' => 'nullable|string|max:100', 'review' => 'required|string|max:1000', 'rating' => 'required|integer|min:1|max:5', 'image' => 'nullable|string', 'status' => 'required|in:active,inactive', ]); $testimonial->update($request->all()); ActivityLog::log("Updated testimonial ID: {$testimonial->id} ({$testimonial->client_name})"); return back()->with('success', 'Testimonial updated successfully.'); } public function destroy(Testimonial $testimonial) { $name = $testimonial->client_name; $testimonial->delete(); ActivityLog::log("Deleted testimonial from: {$name}"); return back()->with('success', 'Testimonial deleted successfully.'); } }
Simpan