diff --git a/app/Exports/FeedbakExport.php b/app/Exports/FeedbakExport.php index 750b4f6..605cf2f 100644 --- a/app/Exports/FeedbakExport.php +++ b/app/Exports/FeedbakExport.php @@ -10,7 +10,14 @@ class FeedbakExport implements FromCollection, WithHeadings { public function collection() { - return ManageFeedback::with(['principal', 'feedbackReaction'])->get()->map(function ($feedback) { + return ManageFeedback::with(['principal', 'feedbackReaction', 'restaurant'])->get()->map(function ($feedback) { + $feedbackType = 'N/A'; + if ($feedback->is_app_feedback) { + $feedbackType = 'App Feedback'; + } elseif ($feedback->is_restaurant_feedback) { + $feedbackType = 'Restaurant Feedback'; + } + return [ 'Customer Id' => $feedback->principal ? $feedback->principal->id : 'N/A', 'First Name' => $feedback->principal ? $feedback->principal->first_name : 'N/A', @@ -18,6 +25,8 @@ class FeedbakExport implements FromCollection, WithHeadings 'Feedback Reaction' => $feedback->feedbackReaction ? $feedback->feedbackReaction->feedback_reaction_title : 'N/A', 'Comment' => $feedback->comment, 'Date Received' => $feedback->created_at, + 'Feedback Type' => $feedbackType, + 'Restaurant Name' => $feedback->restaurant ? $feedback->restaurant->name : 'N/A', ]; }); } @@ -30,7 +39,12 @@ class FeedbakExport implements FromCollection, WithHeadings 'Last Name', 'Feedback Reaction', 'Comment', - 'Date Received' + 'Date Received', + 'App Feedback', + 'Restaurant Feedback', + 'Restaurant Name' + + ]; } } diff --git a/app/Http/Controllers/Admin/ManageContactUsController.php b/app/Http/Controllers/Admin/ManageContactUsController.php index ec30c55..f96612b 100644 --- a/app/Http/Controllers/Admin/ManageContactUsController.php +++ b/app/Http/Controllers/Admin/ManageContactUsController.php @@ -22,11 +22,11 @@ class ManageContactUsController extends Controller $isReply = $request->query('is_reply'); if ($isReply == 1) { - $queries = ManageContactUs::with('customer')->where('is_reply', 1)->orderBy('id','asc')->get(); + $queries = ManageContactUs::with('customer')->where('is_reply', 1)->orderBy('id','desc')->get(); } elseif ($isReply == 0 && $isReply != null) { - $queries = ManageContactUs::with('customer')->where('is_reply', 0)->orderBy('id','asc')->get(); + $queries = ManageContactUs::with('customer')->where('is_reply', 0)->orderBy('id','desc')->get(); } else { - $queries = ManageContactUs::with('customer')->orderBy('id','asc')->get(); + $queries = ManageContactUs::with('customer')->orderBy('id','desc')->get(); } return view('Admin.pages.manage_contact_us.manage_contact', compact('queries')); } diff --git a/app/Services/APIs/RestaurantService/RestCMSService.php b/app/Services/APIs/RestaurantService/RestCMSService.php index 1eb2f4c..9003759 100644 --- a/app/Services/APIs/RestaurantService/RestCMSService.php +++ b/app/Services/APIs/RestaurantService/RestCMSService.php @@ -104,8 +104,8 @@ class RestCMSService public function RestNewsArticles() { try { - $data['customer'] = NewsArticle::select('id', 'news_articles_category_xid','name', 'description', 'thumbnail_image', 'image',) - ->where([['is_active', '0'], ['news_articles_category_xid', '1']]) + $data['customer'] = NewsArticle::select('id', 'name', 'description', 'thumbnail_image', 'image') + ->where([['is_active', '1'], ['news_articles_category_xid', '1']]) ->get() ->map(function ($item) { $item['description'] = strip_tags($item['description']); @@ -114,7 +114,7 @@ class RestCMSService ->toArray(); $data['restaurant'] = NewsArticle::select('id', 'news_articles_category_xid','name', 'description', 'thumbnail_image', 'image') - ->where([['is_active', '0'], ['news_articles_category_xid', '2']]) + ->where([['is_active', '1'], ['news_articles_category_xid', '2']]) ->get() ->map(function ($item) { $item['description'] = strip_tags($item['description']);