<?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',
));
}
}
Service Section
Discover how our services are designed to enhance your NFC Pay experience with convenience, security, and innovative solutions. From managing transactions to secure payments, we are dedicated to providing seamless support every step of the way.
Easily save your credit and debit card details within our app for quick and secure transactions. This feature ensures that your payment information is protected with advanced encryption and can be used for future purchases with just a tap.
Transfer funds quickly and securely between users with our streamlined money transfer service. Simply select the recipient, enter the amount, and authorize the transaction for instant, hassle-free transfers.
Activate your merchant account effortlessly to start receiving payments. Our intuitive setup process ensures that you can begin accepting transactions smoothly, helping your business thrive with minimal setup time.
Keep track of all your transactions in real time through our app. Monitor payment statuses, view transaction history, and manage your account efficiently, ensuring complete control over your financial activities.
Our dedicated support team is available to assist you with any queries or issues. Whether you need help with setting up your account or resolving transaction-related questions, we’re here to provide prompt and reliable assistance.