Files
cheerstothe_season_2.0/app/Http/Controllers/Admin/ManageFeedbackController.php

59 lines
1.4 KiB
PHP
Raw Normal View History

2024-05-23 15:20:21 +05:30
<?php
namespace App\Http\Controllers\Admin;
2024-06-17 15:53:38 +05:30
use App\Exports\FeedbakExport;
2024-05-23 15:20:21 +05:30
use App\Http\Controllers\Controller;
2024-06-10 15:40:43 +05:30
use App\Models\ManageFeedback;
2024-05-23 15:20:21 +05:30
use Illuminate\Http\Request;
2024-06-17 15:53:38 +05:30
use Maatwebsite\Excel\Facades\Excel;
2024-05-23 15:20:21 +05:30
class ManageFeedbackController extends Controller
{
2024-06-05 20:10:10 +05:30
2024-06-10 15:40:43 +05:30
/**
* Created By : sayali parab
* Created at : 17 May 2024
* Use : To get manage feedback page.
*/
public function index()
{
2024-05-23 15:20:21 +05:30
2024-06-18 13:18:04 +05:30
$feedback = ManageFeedback::with('principal', 'feedbackReaction','restaurant')
2024-06-10 15:40:43 +05:30
->orderBy('created_at', 'desc')
->get();
return view('Admin.pages.manage_feedback.manage_feedback', compact('feedback'));
}
2024-06-11 15:09:59 +05:30
/**
* Created By : Sayli Raut
* Created at : 10 June 2024
* Use : To delete query.
*/
2024-06-10 15:40:43 +05:30
public function delete_feedback($id)
{
$data = ManageFeedback::find($id)->delete();
return redirect()->back()->with('success', '');
2024-05-23 15:20:21 +05:30
}
2024-06-17 15:53:38 +05:30
/*
Created By : Sayli Raut
Created at : 17 June 2024
Use : To download Excel.
*/
public function exportSelectedFeedback(Request $request)
{
// dd($request->all());
try {
if ($request->has('all_id')) {
return Excel::download(new FeedbakExport, 'Feedback_data.xlsx');
}
} catch (\Exception $e) {
return response()->json(['error' => 'Export failed. Something went wrong.'], 500);
}
}
2024-05-23 15:20:21 +05:30
}