/home/kueuepay/public_html/app/Http/Controllers/Frontend/IndexController.php
<?php

namespace App\Http\Controllers\Frontend;

use Exception;
use Illuminate\Http\Request;
use App\Models\Admin\Language;
use App\Models\Admin\UsefulLink;
use App\Models\Frontend\Subscribe;
use App\Http\Controllers\Controller;
use App\Models\Frontend\Announcement;
use App\Models\Frontend\AnnouncementCategory;
use App\Models\Frontend\ContactRequest;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Validator;
use App\Providers\Admin\BasicSettingsProvider;

class IndexController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(BasicSettingsProvider $basic_settings)
    {
        $page_title = $basic_settings->get()?->site_name . " | " . $basic_settings->get()?->site_title;
        return view('frontend.index',compact('page_title'));
    }

    public function subscribe(Request $request) {
        $validator = Validator::make($request->all(),[
            'email'     => "required|string|email|max:255|unique:subscribes",
        ]);

        if($validator->fails()) return redirect('/#subscribe-form')->withErrors($validator)->withInput();

        $validated = $validator->validate();
        try{
            Subscribe::create([
                'email'         => $validated['email'],
                'created_at'    => now(),
            ]);
        }catch(Exception $e) {
            return redirect('/#subscribe-form')->with(['error' => ['Failed to subscribe. Try again']]);
        }

        return redirect(url()->previous() .'/#subscribe-form')->with(['success' => ['Subscription successful!']]);
    }

    public function contactMessageSend(Request $request) {

        $validated = Validator::make($request->all(),[
            'name'      => "required|string|max:255",
            'email'     => "required|email|string|max:255",
            'message'   => "required|string|max:5000",
        ])->validate();

        try{
            ContactRequest::create($validated);
        }catch(Exception $e) {
            return back()->with(['error' => ['Failed to send message. Please Try again']]);
        }

        return back()->with(['success' => ['Message send successfully!']]);
    }

    public function usefulLink($slug) {
        $useful_link = UsefulLink::where("slug",$slug)->first();
        if(!$useful_link) abort(404);

        $basic_settings = BasicSettingsProvider::get();

        $app_local = get_default_language_code();
        $page_title = $useful_link->title?->language?->$app_local?->title ?? $basic_settings->site_name;
  
        return view('frontend.pages.useful-link',compact('page_title','useful_link'));
    }


    public function languageSwitch(Request $request) {
        $code = $request->target;
        $language = Language::where("code",$code)->first();
        if(!$language) {
            return back()->with(['error' => ['Oops! Language Not Found!']]);
        }
        Session::put('local',$code);
        Session::put('local_dir',$language->dir);

        return back()->with(['success' => ['Language Switch to ' . $language->name ]]);
    }
    /**
     * Method for view save card
     * @return view
     */
    public function saveCard(){
        $page_title     = "Save Card";
        return view('frontend.pages.save-card',compact('page_title'));
    }
    /**
     * Method for view transfer money 
     * @return view
     */
    public function transferMoney(){
        $page_title     = "Transfer Money";
        return view('frontend.pages.transfer-money',compact('page_title'));
    }
    /**
     * Method for view payment system 
     * @return view
     */
    public function paymentSystem(){
        $page_title     = "Payment System";
        return view('frontend.pages.payment-system',compact('page_title'));
    }
    /**
     * Method for view accept payment 
     * @return view
     */
    public function acceptPayment(){
        $page_title     = "Accept Payment";
        return view('frontend.pages.accept-payment',compact('page_title'));
    }
    /**
     * Method for view about page
     * @return view
     */
    public function about(){
        $page_title     = "About";
        return view('frontend.pages.about',compact('page_title'));
    }
    /**
     * Method for view service page
     * @return view
     */
    public function service(){
        $page_title     = "Service";

        return view('frontend.pages.service',compact('page_title'));
    }
    /**
     * Method for view contact page 
     * @return view
     */
    public function contact(){
        $page_title     = "Contact";

        return view('frontend.pages.contact',compact('page_title'));
    }
    /**
     * Method for view web journal page
     * @return view  
     */
    public function webJournal(){
        $page_title     = "Web Journal";
        $journals        = Announcement::with(['category'])->where('status',true)->latest()->paginate(10);

        return view('frontend.pages.journal',compact(
            'page_title',
            'journals'
        ));
    }
    /**
     * Method for journal details page
     * @param $slug
     * @param Illuminate\Http\Request $request
     */
    public function journalDetails($slug){
        $page_title             = "Journal Details";
        $journal                = Announcement::where('slug',$slug)->first();
        if(!$journal) return back()->with(['error' => ['Something went wrong! Please try again.']]);
        $category               = AnnouncementCategory::withCount('announcements')->where('status',true)->get();
        $recent_posts           = Announcement::where('status',true)->where('slug','!=',$slug)->get();

        return view('frontend.pages.journal-details',compact(
            'page_title',
            'journal',
            'category',
            'recent_posts'
        ));

    }
    /**
     * Method for journal details page
     * @param $slug
     * @param Illuminate\Http\Request $request
     */
    public function journalCategory($id){
        $page_title             = "Journal Details";
        $blog_category          = AnnouncementCategory::where('id',$id)->first();
        if(!$blog_category) abort(404);
        $blogs                  = Announcement::where('announcement_category_id',$blog_category->id)->latest()->paginate(6);

        return view('frontend.pages.journal-category',compact(
            'page_title',
            'blogs',
            'blog_category',
        ));

    }
}
Privacy Policy
top

At NFC Pay, your privacy is of utmost importance to us. This Privacy Policy outlines how we collect, use, share, and protect your personal information when you use our services, including our website and mobile applications.
1. Information We Collect
 

2. How We Use Your Information
We use the information we collect for the following purposes:
 

3. Sharing Your Information
We may share your personal information in the following circumstances:
 

4. Security of Your Information
We take the security of your personal information seriously and implement a variety of security measures, including encryption, secure servers, and access controls, to protect your data from unauthorized access, disclosure, alteration, or destruction. However, no method of transmission over the internet or electronic storage is completely secure, and we cannot guarantee its absolute security.
5. Your Privacy Rights
Depending on your location, you may have certain rights regarding your personal information, such as:
 

6. Third-Party Links
Our services may contain links to third-party websites or services. We are not responsible for the privacy practices or the content of these third-party sites. We encourage you to review the privacy policies of those third parties.
7. Children’s Privacy
Our services are not intended for individuals under the age of 13. We do not knowingly collect personal information from children under 13. If we become aware that we have collected personal information from a child under 13, we will take steps to delete that information.
8. Changes to This Privacy Policy
We may update this Privacy Policy from time to time to reflect changes in our practices or for other operational, legal, or regulatory reasons. We will notify you of any significant changes by posting the new Privacy Policy on our website and updating the effective date.
9. Contact Us
If you have any questions or concerns about this Privacy Policy or our data practices, please contact us at:
Email: support@nfcpay.com