first commit
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/public/uploads/*
|
||||
/public/assets/uploads/*
|
||||
.env
|
||||
30
.htaccess
Normal file
30
.htaccess
Normal file
@@ -0,0 +1,30 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
# Disable index view
|
||||
Options -Indexes
|
||||
|
||||
# block files which needs to be hidden, specify .example extension of the file
|
||||
<Files ~ "\.(env|env.example|json|config.js|md|gitignore|gitattributes|lock)$">
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
</Files>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Send Requests To Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
||||
27
app/Console/Kernel.php
Normal file
27
app/Console/Kernel.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*/
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*/
|
||||
protected function commands(): void
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
||||
30
app/Exceptions/Handler.php
Normal file
30
app/Exceptions/Handler.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* The list of the inputs that are never flashed to the session on validation exceptions.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
107
app/Exports/UsersExport.php
Normal file
107
app/Exports/UsersExport.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\Frontend\payment_transaction_master;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
class UsersExport implements FromCollection, WithHeadings {
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
|
||||
// protected $startDate;
|
||||
// protected $endDate;
|
||||
// protected $selectedCountry;
|
||||
//
|
||||
//
|
||||
// public function headings(): array {
|
||||
// return[
|
||||
// 'Sr.no',
|
||||
// 'User Name',
|
||||
// 'Transaction ID',
|
||||
// 'Program Name',
|
||||
// 'Start Date',
|
||||
// 'End Date',
|
||||
// 'Duration',
|
||||
// 'Country',
|
||||
// 'Currency',
|
||||
// 'Amount',
|
||||
// 'Payment Date'
|
||||
// ];
|
||||
// }
|
||||
//
|
||||
// public function collection() {
|
||||
//
|
||||
//
|
||||
//
|
||||
// return payment_transaction_master::leftJoin('iam_principal', 'iam_principal.id', '=', 'payment_transaction_masters.principal_xid')
|
||||
// ->join('programs', 'programs.id', '=', 'payment_transaction_masters.programs_xid')
|
||||
// ->join('countries', 'countries.id', '=', 'programs.country_xid')
|
||||
// ->select('payment_transaction_masters.id', 'iam_principal.first_name as user_name', 'transaction_id', 'programs.program_title as program_title', 'programs.start_date as start_date', 'programs.end_date as end_date', 'payment_transaction_masters.duration', 'countries.name as program_country', 'currency', 'amount', 'payment_transaction_masters.created_at')
|
||||
//
|
||||
// ->latest()
|
||||
// ->get();
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
protected $data;
|
||||
|
||||
public function __construct($data = null) {
|
||||
if ($data instanceof Collection) {
|
||||
$this->data = $data;
|
||||
} elseif (is_array($data)) {
|
||||
$this->data = collect($data);
|
||||
} else {
|
||||
$this->data = collect(); // Initialize an empty collection
|
||||
}
|
||||
}
|
||||
|
||||
public function headings(): array {
|
||||
return [
|
||||
'Sr.no',
|
||||
'User Name',
|
||||
'Transaction ID',
|
||||
'Program Name',
|
||||
'Start Date',
|
||||
'End Date',
|
||||
'Duration',
|
||||
'Country',
|
||||
'Currency',
|
||||
'Amount',
|
||||
'Payment Date'
|
||||
];
|
||||
}
|
||||
|
||||
public function collection() {
|
||||
if ($this->data->isEmpty()) {
|
||||
// Fetch the default data if no filtered data is provided
|
||||
return payment_transaction_master::leftJoin('iam_principal', 'iam_principal.id', '=', 'payment_transaction_masters.principal_xid')
|
||||
->join('programs', 'programs.id', '=', 'payment_transaction_masters.programs_xid')
|
||||
->join('countries', 'countries.id', '=', 'programs.country_xid')
|
||||
->select(
|
||||
'payment_transaction_masters.id',
|
||||
'iam_principal.first_name as user_name',
|
||||
'transaction_id',
|
||||
'programs.program_title as program_title',
|
||||
'programs.start_date as start_date',
|
||||
'programs.end_date as end_date',
|
||||
'payment_transaction_masters.duration',
|
||||
'countries.name as program_country',
|
||||
'currency',
|
||||
'amount',
|
||||
'payment_transaction_masters.created_at'
|
||||
)
|
||||
->latest('payment_transaction_masters.created_at') // Specify the table for created_at
|
||||
->get();
|
||||
|
||||
}
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
212
app/Http/Controllers/Admin/AdminLoginController.php
Normal file
212
app/Http/Controllers/Admin/AdminLoginController.php
Normal file
@@ -0,0 +1,212 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Carbon\Carbon;
|
||||
use Validator;
|
||||
use App\Models\Admin\manage_admin;
|
||||
use App\Mail\Backend\AdminOtp;
|
||||
|
||||
class AdminLoginController extends Controller {
|
||||
|
||||
public function index() {
|
||||
return view('Admin.sign_in');
|
||||
}
|
||||
|
||||
public function two_steps() {
|
||||
return view('Admin.two_steps');
|
||||
}
|
||||
|
||||
public function login(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'email' => [
|
||||
'required',
|
||||
'email',
|
||||
],
|
||||
'password' => [
|
||||
'required',
|
||||
'min:8'
|
||||
],
|
||||
], [
|
||||
'email.required' => 'Please enter your email address.',
|
||||
'email.email' => 'Please enter a valid email address.',
|
||||
'password.required' => 'Please enter a password.',
|
||||
'password.min' => 'Your password must be at least :min characters.',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['error' => $validator->errors(), 'status' => 204]);
|
||||
}
|
||||
|
||||
// try {
|
||||
$pin = intval($request->digit_pin);
|
||||
|
||||
$admin = manage_admin::where('email', $request->email)
|
||||
->where('pin', $pin)
|
||||
->where('status', 1)
|
||||
->first();
|
||||
|
||||
$credentials = [
|
||||
'email' => $request->email,
|
||||
'password' => $request->password,
|
||||
];
|
||||
|
||||
if ($admin && Hash::check($request->password, $admin->password)) {
|
||||
|
||||
$otp = rand(1234, 9999);
|
||||
if (isset($admin)) {
|
||||
Session::put('email', $request->email);
|
||||
$admin->otp = $otp;
|
||||
$admin_name = $admin->name;
|
||||
$admin->expire_at = Carbon::now('Asia/colombo')->addMinutes(2);
|
||||
$admin->update();
|
||||
Session::put('expire_at', $admin->expire_at);
|
||||
$mailData = [
|
||||
'email' => $request->email,
|
||||
'name' => $admin_name,
|
||||
'otp' => $otp,
|
||||
];
|
||||
$check = Mail::to($request->email)->send(new AdminOtp($mailData));
|
||||
|
||||
// dd($mailData);
|
||||
}
|
||||
$sessionDetails = Session::put('data', $admin);
|
||||
|
||||
return response()->json(['message' => 'Credentials Verified Successfully', 'type' => 'admin', 'status' => 200]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'status' => 401,
|
||||
'message' => 'Invalid Credentials',
|
||||
]);
|
||||
}
|
||||
// } catch (\Exception $e) {
|
||||
// return response()->json(['error' => 'Netwrok Error! Please try again after sometime.']);
|
||||
// }
|
||||
}
|
||||
|
||||
public function verifyOtp(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'email' => [
|
||||
'required',
|
||||
'email',
|
||||
],
|
||||
'otp' => [
|
||||
'required',
|
||||
],
|
||||
], [
|
||||
'email.required' => 'Please enter your email address.',
|
||||
'email.email' => 'Please enter a valid email address.',
|
||||
'otp.required' => 'Please enter the OTP.',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['error' => $validator->errors(), 'status' => 204]);
|
||||
}
|
||||
|
||||
// try {
|
||||
$admin = manage_admin::where('email', $request->email)
|
||||
->where('otp', $request->otp)
|
||||
->where('status', 1)
|
||||
->where('expire_at', '>', Carbon::now('Asia/colombo'))
|
||||
->first();
|
||||
// dd($admin);
|
||||
|
||||
if ($admin) {
|
||||
Auth::guard('admin')->login($admin);
|
||||
$admin->update([
|
||||
'last_login' => now(),
|
||||
]);
|
||||
return response()->json([
|
||||
'message' => 'Logged in Successfully',
|
||||
'data' => [
|
||||
'name' => $admin->name,
|
||||
],
|
||||
'type' => 'admin',
|
||||
'status' => 200,
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'status' => 401,
|
||||
'success' => '0',
|
||||
'message' => 'Invalid OTP or expired.',
|
||||
]);
|
||||
}
|
||||
// } catch (\Exception $e) {
|
||||
// return response()->json(['error' => 'Network Error! Please try again after some time.']);
|
||||
// }
|
||||
}
|
||||
|
||||
public function resendOtp(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'email' => [
|
||||
'required',
|
||||
'email',
|
||||
],
|
||||
], [
|
||||
'email.required' => 'Please enter your email address.',
|
||||
'email.email' => 'Please enter a valid email address.',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['error' => $validator->errors(), 'status' => 204]);
|
||||
}
|
||||
|
||||
try {
|
||||
$admin = manage_admin::where('email', $request->email)
|
||||
->where('status', 1)
|
||||
->first();
|
||||
|
||||
if ($admin) {
|
||||
$otp = rand(1234, 9999);
|
||||
|
||||
$admin->otp = $otp;
|
||||
$admin->expire_at = Carbon::now('Asia/Colombo')->addMinutes(2);
|
||||
$admin->update();
|
||||
|
||||
$mailData = [
|
||||
'email' => $request->email,
|
||||
'name' => $admin->name,
|
||||
'otp' => $otp,
|
||||
];
|
||||
Mail::to($request->email)->send(new AdminOtp($mailData));
|
||||
|
||||
return response()->json([
|
||||
'message' => 'OTP has been resent to your email address.',
|
||||
'status' => 200,
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'status' => 401,
|
||||
'message' => 'Invalid email address or user does not exist.',
|
||||
]);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return response()->json(['error' => 'Network Error! Please try again after some time.']);
|
||||
}
|
||||
}
|
||||
|
||||
// public function logout()
|
||||
// {
|
||||
//// if (Auth::guard('admin')->check()) {
|
||||
//// Auth::guard('admin')->logout();
|
||||
//// }
|
||||
// $admin = auth()->guard('admin')->user();
|
||||
// if ($admin) {
|
||||
// $admin->logout();
|
||||
// }
|
||||
// return redirect()->route('admin_sign_in');
|
||||
//
|
||||
// }
|
||||
|
||||
public function logout() {
|
||||
auth()->guard('admin')->logout();
|
||||
return redirect('/admin_sign_in'); // Redirect to your login page
|
||||
}
|
||||
|
||||
}
|
||||
32
app/Http/Controllers/Admin/DashboardContoller.php
Normal file
32
app/Http/Controllers/Admin/DashboardContoller.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Frontend\ContactUs;
|
||||
use App\Models\Admin\program;
|
||||
use App\Models\Frontend\User;
|
||||
use App\Models\Admin\country;
|
||||
use App\Models\Admin\blog;
|
||||
|
||||
class DashboardContoller extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$contact_us = ContactUs::where('is_replay', 0)->get()->toArray();
|
||||
$program_count = program::count();
|
||||
$user_count = User::count();
|
||||
$country_count = country::count();
|
||||
return view('Admin.dashboard')->with(['pending_contact_us'=>$contact_us,'program_counts'=>$program_count,'user_counts'=>$user_count,'country_count'=>$country_count]);
|
||||
}
|
||||
|
||||
public function get_total_program()
|
||||
{
|
||||
$programCount = program::count();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
48
app/Http/Controllers/Admin/LocationController.php
Normal file
48
app/Http/Controllers/Admin/LocationController.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\state;
|
||||
use App\Models\Admin\country;
|
||||
use App\Models\Admin\city;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class LocationController extends Controller
|
||||
{
|
||||
public function fetchCountry()
|
||||
{
|
||||
$data['countries'] = country::get(["name","id"]);
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function fetchState(Request $request): JsonResponse
|
||||
{
|
||||
$data['states'] = state::where("country_xid", $request->country_id)
|
||||
->get(["name", "id"]);
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function fetchCity(Request $request): JsonResponse
|
||||
{
|
||||
$data['cities'] = city::where("states_xid", $request->state_id)
|
||||
->get(["name", "id"]);
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function deleteCity($id)
|
||||
{
|
||||
$delete_city = city::find($id)->delete();
|
||||
}
|
||||
|
||||
public function change_cities_Status(Request $request)
|
||||
{
|
||||
|
||||
$status = city::find($request->program_id);
|
||||
$status->is_active = $request->status;
|
||||
$status->save();
|
||||
return response()->json(['success'=>'Status change successfully.']);
|
||||
|
||||
}
|
||||
}
|
||||
14
app/Http/Controllers/Admin/LoginController.php
Normal file
14
app/Http/Controllers/Admin/LoginController.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.sign_in');
|
||||
}
|
||||
}
|
||||
158
app/Http/Controllers/Admin/ManageBlogController.php
Normal file
158
app/Http/Controllers/Admin/ManageBlogController.php
Normal file
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Admin\blog_category;
|
||||
use App\Models\Admin\blog;
|
||||
use Illuminate\Http\Request;
|
||||
use Carbon\Carbon;
|
||||
|
||||
|
||||
class ManageBlogController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$blog_category = Blog::orderBy('created_at', 'desc')->get()->toArray();
|
||||
// dd($blog_category);
|
||||
return view('Admin.Pages.manage_cms.manage_blogs.manage_blog')->with(['blog'=>$blog_category]);
|
||||
}
|
||||
|
||||
public function add_blog()
|
||||
{
|
||||
$blog = blog_category::all()->toArray();
|
||||
return view('Admin.Pages.manage_cms.manage_blogs.add_blog')->with(['blog_category'=>$blog]);
|
||||
}
|
||||
|
||||
public function insert_blog(Request $request)
|
||||
{
|
||||
// for image upload start
|
||||
|
||||
$file = $request->file('file');
|
||||
$ext = $file->extension();
|
||||
$file_name = time().'.'.$ext;
|
||||
$path = public_path().'/assets/uploads/blogs';
|
||||
$file-> move($path,$file_name);
|
||||
|
||||
// for image upload end
|
||||
$blog = new blog;
|
||||
$blog->title = $request->input('blog_title');
|
||||
$blog->blog_categories_xid = $request->input('blog_category');
|
||||
$blog->description = $request->input('blog_discription');
|
||||
$blog->blog_image = $file_name;
|
||||
$blog->publish_date = $request->input('publish_date');
|
||||
$blog->save();
|
||||
return response()->json(['success' => true,'status'=>200]);
|
||||
}
|
||||
|
||||
public function view_blog($id)
|
||||
{
|
||||
$blog_categ = blog_category::all()->toArray();
|
||||
$blog = blog::find($id);
|
||||
return view('Admin.Pages.manage_cms.manage_blogs.view_blog')->with(['single_blog_detail'=>$blog,'blog_category'=>$blog_categ]);;
|
||||
}
|
||||
|
||||
public function edit_blog($id)
|
||||
{
|
||||
$blog_categ = blog_category::all()->toArray();
|
||||
$blog = blog::find($id);
|
||||
return view('Admin.Pages.manage_cms.manage_blogs.edit_blog')->with(['single_blog_detail'=>$blog,'blog_category'=>$blog_categ]);
|
||||
}
|
||||
|
||||
public function update_blog(Request $request)
|
||||
{
|
||||
$blog = Blog::find($request->edit_blog_id);
|
||||
|
||||
// Check if any field values are different from the form data
|
||||
$isChanged = false;
|
||||
|
||||
// Compare title
|
||||
if ($blog->title != $request->input('title')) {
|
||||
$blog->title = $request->input('title');
|
||||
$isChanged = true;
|
||||
}
|
||||
|
||||
// Compare blog category
|
||||
if ($blog->blog_categories_xid != $request->input('blog_category')) {
|
||||
$blog->blog_categories_xid = $request->input('blog_category');
|
||||
$isChanged = true;
|
||||
}
|
||||
|
||||
// Compare description
|
||||
if ($blog->description != $request->input('description')) {
|
||||
$blog->description = $request->input('description');
|
||||
$isChanged = true;
|
||||
}
|
||||
|
||||
// Compare publish date
|
||||
if ($blog->publish_date != $request->input('publish_date')) {
|
||||
$blog->publish_date = $request->input('publish_date');
|
||||
$isChanged = true;
|
||||
}
|
||||
|
||||
// Handle file upload if a file is provided
|
||||
if ($request->hasFile('file') && $request->file('file')->isValid()) {
|
||||
$file_one = $request->file('file');
|
||||
$ext = $file_one->extension();
|
||||
$file_name_main_image = time() . '.' . $ext;
|
||||
$path = public_path() . '/assets/uploads/blogs';
|
||||
$file_one->move($path, $file_name_main_image);
|
||||
|
||||
// Compare blog image
|
||||
if ($blog->blog_image != $file_name_main_image) {
|
||||
$blog->blog_image = $file_name_main_image;
|
||||
$isChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Save the blog if there are changes
|
||||
if ($isChanged) {
|
||||
$blog->save();
|
||||
}
|
||||
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
|
||||
// blog blog start here
|
||||
public function index_categories()
|
||||
{
|
||||
$blog_category = blog_category::all()->toArray();
|
||||
return view('Admin.Pages.manage_cms.manage_blogs.manage_blog_categ.manage_blog_categories')->with(['category'=>$blog_category]);
|
||||
}
|
||||
|
||||
public function insert_category(Request $request)
|
||||
{
|
||||
$blog = new blog_category;
|
||||
$blog->category_name = $request->input('category_name');
|
||||
$blog->save();
|
||||
return response()->json(['success' => true,'status'=>200]);
|
||||
}
|
||||
|
||||
|
||||
public function update_category(Request $request)
|
||||
{
|
||||
$blog = blog_category::find($request->edit_category_id);
|
||||
$blog->category_name = $request->input('edit_category_name');
|
||||
$blog->save();
|
||||
return response()->json(['success' => true,'status'=>200]);
|
||||
}
|
||||
|
||||
public function delete_blog_categ($id)
|
||||
{
|
||||
$blog_categ = blog_category::find($id)->delete();
|
||||
}
|
||||
|
||||
public function delete_blog($id)
|
||||
{
|
||||
$blog_categ = blog::find($id)->delete();
|
||||
}
|
||||
|
||||
|
||||
// blog blog end here
|
||||
|
||||
|
||||
// blog blog start here
|
||||
|
||||
|
||||
}
|
||||
14
app/Http/Controllers/Admin/ManageCmsController.php
Normal file
14
app/Http/Controllers/Admin/ManageCmsController.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ManageCmsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('Admin.Pages.manage_cms.manage_cms');
|
||||
}
|
||||
}
|
||||
150
app/Http/Controllers/Admin/ManageCountriesController.php
Normal file
150
app/Http/Controllers/Admin/ManageCountriesController.php
Normal file
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\state;
|
||||
use App\Models\Admin\country;
|
||||
use App\Models\Admin\city;
|
||||
|
||||
|
||||
class ManageCountriesController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
|
||||
// $get_location = city::with('get_state','get_state.get_country')->get()->toArray();
|
||||
// return view('Admin.Pages.manage_countries.manage_countries')->with(['country'=>$country,'location'=>$get_location]);
|
||||
$country = country::all()->toArray();
|
||||
return view('Admin.Pages.manage_countries.manage_countries')->with(['country'=>$country]);
|
||||
}
|
||||
|
||||
public function insert_data(Request $request)
|
||||
{
|
||||
// $country = country::where('id',$request->country)->first();
|
||||
// $state = state::where('id',$request->state)->first();
|
||||
// $city = city::where('id',$request->city)->first();
|
||||
// for image upload start
|
||||
|
||||
$file = $request->file('image');
|
||||
$ext = $file->extension();
|
||||
$file_name = time().'.'.$ext;
|
||||
$path = public_path().'/assets/uploads/countries';
|
||||
$file-> move($path,$file_name);
|
||||
// dd($path);
|
||||
|
||||
// File upload handling
|
||||
// if ($request->hasFile('file')) {
|
||||
// $file = $request->file('file');
|
||||
// $ext = $file->getClientOriginalExtension();
|
||||
// $file_name = time().'.'.$ext;
|
||||
// $path = public_path().'/assets/uploads/countries';
|
||||
// $file->move($path, $file_name);
|
||||
//
|
||||
// // Return a success response
|
||||
// return response()->json(['message' => 'File uploaded successfully.']);
|
||||
// } else {
|
||||
// return response()->json(['message' => 'No file uploaded.'], 400);
|
||||
// }
|
||||
|
||||
// for image upload end
|
||||
|
||||
// if(!isset($country))
|
||||
// {
|
||||
$country = new country;
|
||||
$country->image = $file_name;
|
||||
$country->name = $request->input('country');
|
||||
$country->country_code = $request->input('code');
|
||||
$country->discription = $request->input('discription');
|
||||
$country->language = $request->input('language');
|
||||
$country->save();
|
||||
// }
|
||||
|
||||
// if(!isset($state))
|
||||
// {
|
||||
// $state = new state;
|
||||
// $state->country_xid = $country->id;
|
||||
// $state->name = $request->input('state');
|
||||
// $state->save();
|
||||
// }
|
||||
//
|
||||
// if(!isset($city))
|
||||
// {
|
||||
// $city = new city;
|
||||
// $city->states_xid = $state->id;
|
||||
// $city->name = $request->input('city');
|
||||
// $city->save();
|
||||
// }
|
||||
|
||||
return response()->json(['success' => true,'status'=>200]);
|
||||
}
|
||||
|
||||
// public function edit_countries($id){
|
||||
// $country = country::all()->toArray();
|
||||
// dd($country);
|
||||
//
|
||||
// }
|
||||
|
||||
// public function update_countries(Request $request)
|
||||
// {
|
||||
//
|
||||
//
|
||||
// $file_one = $request->file('image');
|
||||
//// dd($file_one);
|
||||
// $ext = $file_one->extension();
|
||||
// $file_name_main_image = time() . '.' . $ext;
|
||||
// $path = public_path() . '/assets/uploads/countries';
|
||||
// $file_one->move($path, $file_name_main_image);
|
||||
//
|
||||
// $country = country::find($request->edit_country_id);
|
||||
// $country->image = $file_name_main_image;
|
||||
// $country->name = $request->input('country');
|
||||
// $country->country_code = $request->input('code');
|
||||
// $country->discription = $request->input('discription');
|
||||
// $country->language = $request->input('language');
|
||||
// $country->save();
|
||||
// return response()->json(['success' => true,'status'=>200]);
|
||||
// }
|
||||
|
||||
public function update_countries(Request $request)
|
||||
{
|
||||
$country = country::find($request->edit_country_id);
|
||||
// dd($request->edit_country_id);
|
||||
|
||||
if ($request->hasFile('image')) {
|
||||
$file_one = $request->file('image');
|
||||
$ext = $file_one->extension();
|
||||
$file_name_main_image = time() . '.' . $ext;
|
||||
$path = public_path() . '/assets/uploads/countries';
|
||||
$file_one->move($path, $file_name_main_image);
|
||||
$country->image = $file_name_main_image;
|
||||
}
|
||||
|
||||
$country->name = $request->input('country');
|
||||
$country->country_code = $request->input('code');
|
||||
$country->discription = $request->input('discription');
|
||||
$country->language = $request->input('language');
|
||||
$country->save();
|
||||
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function delete_country($id)
|
||||
{
|
||||
$delete_city = country::find($id)->delete();
|
||||
}
|
||||
|
||||
public function change_country_Status(Request $request)
|
||||
{
|
||||
|
||||
$status = country::find($request->program_id);
|
||||
$status->is_active = $request->status;
|
||||
$status->save();
|
||||
return response()->json(['success'=>'Status change successfully.']);
|
||||
|
||||
}
|
||||
}
|
||||
54
app/Http/Controllers/Admin/ManageFaqController.php
Normal file
54
app/Http/Controllers/Admin/ManageFaqController.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\faq;
|
||||
use App\Models\Admin\country;
|
||||
|
||||
class ManageFaqController extends Controller {
|
||||
|
||||
public function index() {
|
||||
$countries = country::all()->toArray();
|
||||
$faq = Faq::latest()->get()->toArray();
|
||||
return view('Admin.Pages.manage_cms.manage_faq.manage_faq')->with(['faqs' => $faq, 'country' => $countries]);
|
||||
}
|
||||
|
||||
public function insert_faq(Request $request) {
|
||||
$faq = new faq;
|
||||
$faq->question = $request->input('question');
|
||||
$faq->answer = $request->input('answer');
|
||||
$faq->country_xid = $request->input('country');
|
||||
$countryId = $request->input('country');
|
||||
$country = country::find($countryId);
|
||||
if ($country) {
|
||||
$faq->country_xid = $country->id;
|
||||
} else {
|
||||
$faq->country_xid = null;
|
||||
}
|
||||
$faq->save();
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
public function update_faq(Request $request) {
|
||||
// dd($request->all());
|
||||
$faq_id = $request->edit_faq_id;
|
||||
// dd($faq_categories_id);
|
||||
$faq = faq::find($request->edit_faq_id);
|
||||
$faq->question = $request->input('edit_faq_question');
|
||||
$faq->answer = $request->input('edit_faq_answer');
|
||||
$faq->country_xid = $request->input('country');
|
||||
$faq->save();
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
public function delete_faq($id) {
|
||||
$faq = faq::find($id)->delete();
|
||||
}
|
||||
|
||||
public function index_categories() {
|
||||
return view('Admin.Pages.manage_cms.manage_faq.manage_categories.manage_category');
|
||||
}
|
||||
|
||||
}
|
||||
24
app/Http/Controllers/Admin/ManageLatUpdateController.php
Normal file
24
app/Http/Controllers/Admin/ManageLatUpdateController.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\latest_update;
|
||||
|
||||
class ManageLatUpdateController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$latest_update = latest_update::all()->toArray();
|
||||
return view('Admin.Pages.manage_cms.manage_latest_updates.manage_latest_update')->with(['lat_update'=> $latest_update]);
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
$policy = latest_update::find($request->id);
|
||||
$policy->description = $request->input('latest_discription');
|
||||
$policy->save();
|
||||
return response()->json(['success' => true,'status'=>200]);
|
||||
}
|
||||
}
|
||||
53
app/Http/Controllers/Admin/ManageModuleController.php
Normal file
53
app/Http/Controllers/Admin/ManageModuleController.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\manage_module;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ManageModuleController extends Controller {
|
||||
|
||||
public function index() {
|
||||
$data = manage_module::all()->toArray();
|
||||
// dd($data);
|
||||
return view('Admin.Pages.manage_modules.manage_module')->with(['module' => $data]);
|
||||
}
|
||||
|
||||
public function insert(Request $request) {
|
||||
|
||||
$moduleName = $request->input('module_name');
|
||||
|
||||
// Check if the name already exists
|
||||
$existingModule = manage_module::where('name', $moduleName)->first();
|
||||
|
||||
if ($existingModule) {
|
||||
// Name already exists, return an error response
|
||||
return response()->json(['success' => false, 'status' => 400, 'message' => 'Module name already exists']);
|
||||
}
|
||||
|
||||
$data = new manage_module;
|
||||
$data->name = $request->input('module_name');
|
||||
$data->slug = Str::slug($data->name);
|
||||
$data->save();
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
public function update_module(Request $request) {
|
||||
|
||||
|
||||
$data = manage_module::find($request->edit_module_id);
|
||||
// dd($data);
|
||||
$data->name = $request->input('module_name');
|
||||
// $data->slug = Str::slug($data->name);
|
||||
$data->slug = $request->input('slug');
|
||||
$data->save();
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
public function delete_module($id) {
|
||||
$data = manage_module::find($id)->delete();
|
||||
}
|
||||
|
||||
}
|
||||
30
app/Http/Controllers/Admin/ManagePrivacyController.php
Normal file
30
app/Http/Controllers/Admin/ManagePrivacyController.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\privacy_policy;
|
||||
|
||||
class ManagePrivacyController extends Controller
|
||||
{
|
||||
|
||||
public function index_privacy()
|
||||
{
|
||||
$policy = privacy_policy::all()->toArray();
|
||||
return view('Admin.Pages.manage_cms.manage_privacy.manage_privacy')->with(['policy'=> $policy] );
|
||||
}
|
||||
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
$policy = privacy_policy::find($request->privacy_id);
|
||||
$input = $request->input('privacy_discription');
|
||||
$convertedInput = str_replace(' ', ' ', $input);
|
||||
$policy->description = trim($convertedInput);
|
||||
// $trim_disp = $request->input('privacy_discription');
|
||||
// $policy->description = trim($trim_disp);
|
||||
$policy->save();
|
||||
return response()->json(['success' => true,'status'=>200]);
|
||||
}
|
||||
}
|
||||
282
app/Http/Controllers/Admin/ManageProgramController.php
Normal file
282
app/Http/Controllers/Admin/ManageProgramController.php
Normal file
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\program;
|
||||
use App\Models\Admin\ProgramCurrencyAmount;
|
||||
use App\Models\Admin\ProgramImage;
|
||||
use App\Models\Admin\program_accomadation;
|
||||
use App\Models\Admin\country;
|
||||
use App\Models\Frontend\news_letter;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Livewire\Component;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Mail\Frontend\NewsLetterMail;
|
||||
|
||||
class ManageProgramController extends Controller {
|
||||
|
||||
public function create() {
|
||||
$countries = country::all()->toArray();
|
||||
return view('Admin.Pages.manage_programs.add_manage_programe')->with(['country' => $countries]);
|
||||
}
|
||||
|
||||
public function programe_view($id) {
|
||||
$countries = country::all()->toArray();
|
||||
$program_detail = program::with('programe_images', 'programe_amount', 'programe_country', 'programe_acomadation')->find($id)->toArray();
|
||||
// dd($program_detail);
|
||||
return view('Admin.Pages.manage_programs.view_manage_programe')->with(['program_details_view' => $program_detail, 'country' => $countries]);
|
||||
}
|
||||
|
||||
public function programe_edit($id) {
|
||||
$countries = country::all()->toArray();
|
||||
$program_detail = program::with('programe_images', 'programe_amount', 'programe_country', 'programe_acomadation')->find($id)->toArray();
|
||||
// dd($program_detail);
|
||||
return view('Admin.Pages.manage_programs.edit_programe')->with(['program_details' => $program_detail, 'country' => $countries]);
|
||||
}
|
||||
|
||||
public function programe_update(Request $request) {
|
||||
// dd($request->all());
|
||||
//********************************** update programe data ********************************\\
|
||||
|
||||
$program = program::find($request->edit_program_id);
|
||||
$program->program_title = $request->input('edit_program_title');
|
||||
$program->challenge_level = $request->input('chag_level');
|
||||
// $program->start_date = $request->input('edit_start_date');
|
||||
// $program->end_date = $request->input('edit_end_date');
|
||||
|
||||
$startDates = $request->input('edit_start_date');
|
||||
$program->start_date = json_encode($startDates);
|
||||
$program->volunteer_weeks = $request->input('edit_weeks');
|
||||
$program->age_rules = $request->input('edit_age_rules');
|
||||
$program->country_xid = $request->input('country');
|
||||
|
||||
if ($request->hasFile('image')) {
|
||||
$uploadedFile = $request->image;
|
||||
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
|
||||
$uploadedFile->move(public_path('assets/uploads/program_images/thumbnail'), $filename);
|
||||
$images = 'assets/uploads/program_images/thumbnail/' . $filename;
|
||||
$program->thumbnail = $images;
|
||||
}
|
||||
|
||||
if ($request->hasFile('brochure')) {
|
||||
$uploadedFile = $request->brochure;
|
||||
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
|
||||
$uploadedFile->move(public_path('assets/uploads/program_images/program_brochure/'), $filename);
|
||||
$program_brochure = 'assets/uploads/program_images/program_brochure/' . $filename;
|
||||
$program->trip_brochure = $program_brochure;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$program->program_title_two = $request->input('edit_program_title_two');
|
||||
$program->description = $request->input('edit_discription');
|
||||
$program->location_info = $request->input('edit_location_info');
|
||||
$program->charges_details = $request->input('edit_charges_details');
|
||||
$program->payment_notice = $request->input('payment_notice');
|
||||
$program->project_information = $request->input('personal_info');
|
||||
$program->personal_gain = $request->input('personal_gain');
|
||||
$program->safety_instructions = $request->input('safety_insta');
|
||||
$program->save();
|
||||
|
||||
//************************************ update programe data ********************************\\
|
||||
//********************************** update programe price data start ********************************\\
|
||||
$amounts_usd = $request->input('amount_usd');
|
||||
// Loop through the arrays and insert into the database
|
||||
$index = 0;
|
||||
$program_currency = ProgramCurrencyAmount::where('programs_xid', $request->edit_program_id)->delete();
|
||||
foreach ($amounts_usd as $index => $amount_usd) {
|
||||
$program_currency = new ProgramCurrencyAmount;
|
||||
$program_currency->programs_xid = $program->id;
|
||||
$program_currency->week = $index + 1;
|
||||
$program_currency->usd_price = $amount_usd;
|
||||
$program_currency->save();
|
||||
}
|
||||
//********************************* update programe price data end ******************************\\
|
||||
//********************************* update programe accomadtion data end ******************************\\
|
||||
$edit_program_acomadation_name = $request->input('progarm_accomadation');
|
||||
$program_id = $request->edit_program_id;
|
||||
$edit_program_acomadation = program_accomadation::where('programs_xid', $program_id)->delete();
|
||||
if ($edit_program_acomadation_name) {
|
||||
foreach ($edit_program_acomadation_name as $program_accomadations) {
|
||||
$program_acomadation = new program_accomadation;
|
||||
$program_acomadation->programs_xid = $program->id;
|
||||
$program_acomadation->accomadation = $program_accomadations;
|
||||
$program_acomadation->save();
|
||||
}
|
||||
}
|
||||
//********************************* update programe accomadtion data end ******************************\\
|
||||
//********************************* update Multi file uploading start ******************************\\
|
||||
// $program_id = $request->edit_program_id;
|
||||
if ($request->hasFile('images')) {
|
||||
// dd($request->hasFile('images'));
|
||||
// $edit_program_images = ProgramImage::where('programs_xid', $program_id)->delete();
|
||||
|
||||
foreach ($request->file('images') as $key => $file) {
|
||||
$filename = date('YmdHi') . '_' . $file->getClientOriginalName();
|
||||
$file->move(public_path('assets/uploads/program_images'), $filename);
|
||||
$images = 'assets/uploads/program_images/' . $filename;
|
||||
$program_images = new ProgramImage();
|
||||
$program_images->programs_xid = $program->id;
|
||||
$program_images->images = $images;
|
||||
|
||||
$program_images->save();
|
||||
}
|
||||
}
|
||||
//********************************* update Multi file uploading end ******************************\\
|
||||
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
public function delete_image(Request $request) {
|
||||
$image = ProgramImage::find($request->image_id);
|
||||
$previous_image = public_path($image->images);
|
||||
File::delete($previous_image);
|
||||
$image->id = $request->image_id;
|
||||
$image->delete();
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
public function index() {
|
||||
|
||||
$programs = program::select('id', 'start_date', 'end_date', 'is_active')->get();
|
||||
|
||||
|
||||
foreach ($programs as $program) {
|
||||
|
||||
|
||||
$startDate = $program->min('start_date');
|
||||
|
||||
|
||||
$dateArray = explode(',', $startDate);
|
||||
|
||||
// Trim each date string to remove any leading/trailing spaces
|
||||
$dateArray = array_map('trim', $dateArray);
|
||||
|
||||
// Get the last date in the array
|
||||
$lastDate = end($dateArray);
|
||||
|
||||
// Clean the last date string
|
||||
$lastDate = preg_replace('/[^0-9\-]/', '', $lastDate);
|
||||
|
||||
// $startDate = Carbon::parse($program->start_date);
|
||||
$endDate = Carbon::parse($lastDate);
|
||||
if ($endDate->isPast()) {
|
||||
$program->is_active = '0';
|
||||
$program->save();
|
||||
}
|
||||
// Check if the end date has expired
|
||||
}
|
||||
$program = program::with('programe_country')
|
||||
->orderBy('created_at', 'desc')
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
// return view('Admin.Pages.manage_programs.manage_program', compact('programs'))->with(['program' => $program]);
|
||||
return view('Admin.Pages.manage_programs.manage_program')->with(['program' => $program]);
|
||||
|
||||
}
|
||||
|
||||
public function insert(Request $request) {
|
||||
dd($request->all());
|
||||
|
||||
$program = new program;
|
||||
$program->program_title = $request->input('program_title');
|
||||
$program->challenge_level = $request->input('chag_level');
|
||||
$startDates = $request->input('multi_start_date');
|
||||
$program->start_date = json_encode($startDates);
|
||||
|
||||
$program->volunteer_weeks = $request->input('weeks');
|
||||
$program->volunteer_weeks_max = $request->input('max_weeks');
|
||||
$program->is_active = 1;
|
||||
if ($request->hasFile('image')) {
|
||||
$uploadedFile = $request->image;
|
||||
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
|
||||
$uploadedFile->move(public_path('assets/uploads/program_images/thumbnail/'), $filename);
|
||||
$images = 'assets/uploads/program_images/thumbnail/' . $filename;
|
||||
$program->thumbnail = $images;
|
||||
}
|
||||
if ($request->hasFile('brochure')) {
|
||||
$uploadedFile = $request->brochure;
|
||||
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
|
||||
$uploadedFile->move(public_path('assets/uploads/program_images/program_brochure/'), $filename);
|
||||
$program_brochure = 'assets/uploads/program_images/program_brochure/' . $filename;
|
||||
$program->trip_brochure = $program_brochure;
|
||||
}
|
||||
$program->age_rules = $request->input('age_rules');
|
||||
$program->country_xid = $request->input('country');
|
||||
$program->program_title_two = $request->input('program_title_two');
|
||||
$program->description = $request->input('discription');
|
||||
$program->location_info = $request->input('location_info');
|
||||
$program->charges_details = $request->input('charges_details');
|
||||
$program->payment_notice = $request->input('payment_notice');
|
||||
$program->project_information = $request->input('personal_info');
|
||||
$program->personal_gain = $request->input('personal_gain');
|
||||
$program->safety_instructions = $request->input('safety_insta');
|
||||
$program->save();
|
||||
|
||||
$amounts_usd = $request->input('amount_usd');
|
||||
$week = $request->input('week');
|
||||
// Loop through the arrays and insert into the database
|
||||
// $index = 0;
|
||||
foreach ($amounts_usd as $amount_usd) {
|
||||
$currency = new ProgramCurrencyAmount();
|
||||
$currency->programs_xid = $program->id;
|
||||
$currency->usd_price = $amount_usd;
|
||||
$currency->week = $week;
|
||||
$currency->save();
|
||||
}
|
||||
|
||||
if ($request->hasFile('images')) {
|
||||
foreach ($request->file('images') as $key => $file) {
|
||||
$filename = date('YmdHi') . '_' . $file->getClientOriginalName();
|
||||
$file->move(public_path('assets/uploads/program_images'), $filename);
|
||||
$images = 'assets/uploads/program_images/' . $filename;
|
||||
$program_images = new ProgramImage();
|
||||
$program_images->programs_xid = $program->id;
|
||||
$program_images->images = $images;
|
||||
$program_images->save();
|
||||
}
|
||||
}
|
||||
|
||||
// insert program accomadtion start
|
||||
$program_accomadation = $request->input('progarm_accomadation');
|
||||
foreach ($program_accomadation as $program_accomadations) {
|
||||
$program_accomadation = new program_accomadation;
|
||||
$program_accomadation->programs_xid = $program->id;
|
||||
$program_accomadation->accomadation = $program_accomadations;
|
||||
$program_accomadation->save();
|
||||
}
|
||||
// insert program accomadtion end
|
||||
//news letter logic
|
||||
|
||||
$newsletter = news_letter::select('email')->get();
|
||||
$emails = [];
|
||||
foreach ($newsletter as $mail) {
|
||||
$emails[] = $mail['email'];
|
||||
}
|
||||
// Mail::send('Frontend.Templates.newsletter', ['program' => $program], function($message) use ($emails) {
|
||||
// $message->to($emails)->subject('this is testing mail when we add a new program');
|
||||
// });
|
||||
Mail::to($emails)->send(new NewsLetterMail($program));
|
||||
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
public function delete($id) {
|
||||
$program = program::find($id);
|
||||
$program->delete();
|
||||
}
|
||||
|
||||
public function change_program_Status(Request $request) {
|
||||
$status = program::find($request->program_id);
|
||||
$status->is_active = $request->status;
|
||||
$status->save();
|
||||
return response()->json(['success' => 'Status change successfully.']);
|
||||
}
|
||||
|
||||
}
|
||||
102
app/Http/Controllers/Admin/ManageSubAdminController.php
Normal file
102
app/Http/Controllers/Admin/ManageSubAdminController.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\manage_admin;
|
||||
use App\Models\Admin\manage_module;
|
||||
use App\Models\Admin\manage_admin_manage_module_link;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
|
||||
class ManageSubAdminController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$data = manage_module::all()
|
||||
->toArray();
|
||||
// $password = 'sneha123';
|
||||
// $hashedPassword = Hash::make($password);
|
||||
// dd($hashedPassword);
|
||||
|
||||
$sub_admin_data = manage_admin::where('is_admin', 1)
|
||||
->get()
|
||||
->toArray();
|
||||
return view('Admin.Pages.manage_sub_admin.manage_sub_admin')->with(['data'=>$data,'sub_admin'=>$sub_admin_data]);
|
||||
}
|
||||
|
||||
public function insert(Request $request)
|
||||
{
|
||||
$insert_admin = new manage_admin;
|
||||
$insert_admin->name = $request->input('sub_admin_name');
|
||||
$insert_admin->email = $request->input('sub_admin_email');
|
||||
$insert_admin->is_admin = 1 ;
|
||||
$insert_admin->password = Hash::make($request->input('password'));
|
||||
$insert_admin->pin = $request->input('admin_pin');
|
||||
$insert_admin->save();
|
||||
|
||||
$moduleIds = $request->input('module_id');
|
||||
foreach ($moduleIds as $moduleId) {
|
||||
$insert_admin_link_data = new manage_admin_manage_module_link;
|
||||
$insert_admin_link_data->sub_admin_xid = $insert_admin->id;
|
||||
$insert_admin_link_data->manage_modules_xid = $moduleId;
|
||||
$insert_admin_link_data->save();
|
||||
}
|
||||
|
||||
return response()->json(['success' => true,'status'=>200]);
|
||||
|
||||
}
|
||||
|
||||
public function get_sub_admin_permission(Request $request) {
|
||||
$testing_admin_id = $request->id;
|
||||
$test = manage_admin_manage_module_link::where('sub_admin_xid', $testing_admin_id)->get('manage_modules_xid')->toArray();
|
||||
return response()->json(['success' => true, 'data' => $test]);
|
||||
}
|
||||
|
||||
public function edit_get_sub_admin_permission(Request $request) {
|
||||
$sub_admin_id = $request->id;
|
||||
$test = manage_admin_manage_module_link::where('sub_admin_xid', $sub_admin_id)->get('manage_modules_xid')->toArray();
|
||||
return response()->json(['success' => true, 'data' => $test]);
|
||||
}
|
||||
|
||||
public function change_sub_admin_status(Request $request) {
|
||||
$status = manage_admin::find($request->sub_admin_id);
|
||||
$status->status = $request->sub_admin_status;
|
||||
$status->save();
|
||||
return response()->json(['success' => 'Status change successfully.']);
|
||||
}
|
||||
|
||||
public function delete_sub_admin($id)
|
||||
{
|
||||
$testimonial = manage_admin::find($id)->delete();
|
||||
}
|
||||
|
||||
public function update_sub_admin(Request $request) {
|
||||
$sub_admin = manage_admin::find($request->sub_admin_id);
|
||||
$sub_admin->name = $request->input('sub_admin_name');
|
||||
$sub_admin->email = $request->input('sub_admin_email');
|
||||
$sub_admin->is_admin = 1 ;
|
||||
$sub_admin->password = Hash::make($request->input('sub_admin_password'));
|
||||
$sub_admin->pin = $request->input('sub_admin_pin');
|
||||
$sub_admin->save();
|
||||
|
||||
$moduleIds = $request->input('module_id');
|
||||
$update_module = manage_admin_manage_module_link::where('sub_admin_xid', $sub_admin->id)->delete();
|
||||
|
||||
if ($moduleIds) {
|
||||
foreach ($moduleIds as $moduleId) {
|
||||
$insert_admin_link_data = new manage_admin_manage_module_link;
|
||||
$insert_admin_link_data->sub_admin_xid = $sub_admin->id;
|
||||
$insert_admin_link_data->manage_modules_xid = $moduleId;
|
||||
$insert_admin_link_data->save();
|
||||
}
|
||||
}
|
||||
return response()->json(['success' => true,'status'=>200]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
32
app/Http/Controllers/Admin/ManageTemplateController.php
Normal file
32
app/Http/Controllers/Admin/ManageTemplateController.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\mail_template;
|
||||
|
||||
class ManageTemplateController extends Controller
|
||||
{
|
||||
public function index_template()
|
||||
{
|
||||
$mail_templates = mail_template::all()->toArray();
|
||||
return view('Admin.Pages.manage_mail_template.manage_template')->with(['mail_temp'=>$mail_templates]);
|
||||
}
|
||||
|
||||
public function edit_template($id)
|
||||
{
|
||||
$message = mail_template::find($id)->toArray();
|
||||
// dd($message);
|
||||
return view('Admin.Pages.manage_mail_template.edit_mail_template')->with(['edit_cont'=>$message]);
|
||||
}
|
||||
|
||||
public function mail_template_update(Request $request)
|
||||
{
|
||||
$message = mail_template::find($request->temp_id);
|
||||
$message->program_title = $request->input('title');
|
||||
$message->description = $request->input('edit_disc');
|
||||
$message->save();
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
}
|
||||
59
app/Http/Controllers/Admin/ManageTestimonialController.php
Normal file
59
app/Http/Controllers/Admin/ManageTestimonialController.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\country;
|
||||
use App\Models\Admin\Testimonial;
|
||||
|
||||
class ManageTestimonialController extends Controller {
|
||||
|
||||
public function index() {
|
||||
$countries = country::all()->toArray();
|
||||
$testimonial = Testimonial::with('country')->get()->toArray();
|
||||
// dd($testimonial);
|
||||
return view('Admin.Pages.manage_cms.manage_testimonials.manage_testimonial')->with(['country' => $countries, 'testimonial' => $testimonial]);
|
||||
}
|
||||
|
||||
public function insert(Request $request) {
|
||||
|
||||
// for image upload end
|
||||
$add_testimonial = new Testimonial;
|
||||
$add_testimonial->name = $request->input('name');
|
||||
if ($request->hasFile('image_path') && $request->file('image_path')->isValid()) {
|
||||
$uploadedFile = $request->file('image_path');
|
||||
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
|
||||
$uploadedFile->move(public_path('assets/uploads/testimonial/'), $filename);
|
||||
$images = 'assets/uploads/testimonial/' . $filename;
|
||||
$add_testimonial->image = $images;
|
||||
}
|
||||
|
||||
$add_testimonial->discription = $request->input('discription');
|
||||
$add_testimonial->country_xid = $request->input('country');
|
||||
$add_testimonial->save();
|
||||
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
public function delete_test($id) {
|
||||
$testimonial = Testimonial::find($id)->delete();
|
||||
}
|
||||
|
||||
public function update(Request $request) {
|
||||
$add_testimonial = Testimonial::find($request->test_id);
|
||||
$add_testimonial->name = $request->input('edit_name');
|
||||
if ($request->hasFile('image_path')) {
|
||||
$uploadedFile = $request->image_path;
|
||||
$filename = date('YmdHi') . '_' . str_replace(' ', '', $uploadedFile->getClientOriginalName());
|
||||
$uploadedFile->move(public_path('/assets/uploads/testimonial'), $filename);
|
||||
$images = 'assets/uploads/testimonial/' . $filename;
|
||||
$add_testimonial->image = $images;
|
||||
}
|
||||
$add_testimonial->discription = $request->input('edit_disc');
|
||||
$add_testimonial->country_xid = $request->input('country');
|
||||
$add_testimonial->save();
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
}
|
||||
52
app/Http/Controllers/Admin/ManageUsersController.php
Normal file
52
app/Http/Controllers/Admin/ManageUsersController.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Frontend\User;
|
||||
use App\Models\Admin\country;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use App\Mail\Backend\DocumentRequest;
|
||||
|
||||
class ManageUsersController extends Controller {
|
||||
|
||||
public function index() {
|
||||
$users = User::orderByDesc('created_at')->get()->toArray();
|
||||
// dd($users);
|
||||
return view('Admin.Pages.manage_users.manage_user')->with(['user' => $users]);
|
||||
}
|
||||
|
||||
public function users_view($id) {
|
||||
$view_users = User::with('get_single_country', 'get_sngle_program','user_documents')->find($id)->toArray();
|
||||
return view('Admin.Pages.manage_users.view_manage_user_')->with(['user_view' => $view_users]);
|
||||
}
|
||||
|
||||
public function users_edit($id) {
|
||||
$edit_users = User::with('get_single_country', 'get_sngle_program', 'user_documents')->find($id)->toArray();
|
||||
// dd($edit_users);
|
||||
return view('Admin.Pages.manage_users.edit_manage_user')->with(['user_edit' => $edit_users]);
|
||||
}
|
||||
|
||||
public function users_update(Request $request) {
|
||||
$blog = User::find($request->user_id);
|
||||
$blog->category_name = $request->input('edit_category_name');
|
||||
$blog->save();
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
public function change_user_Status(Request $request) {
|
||||
$status = User::find($request->user_id);
|
||||
$status->is_active = $request->status;
|
||||
$status->save();
|
||||
return response()->json(['success' => 'Status change successfully.']);
|
||||
}
|
||||
|
||||
public function request_document($userId) {
|
||||
|
||||
$user = User::find($userId);
|
||||
Mail::to($user->email)->send(new DocumentRequest($user));
|
||||
return response()->json(['message' => 'Document request email sent successfully!']);
|
||||
}
|
||||
|
||||
}
|
||||
40
app/Http/Controllers/Admin/ManageWebsiteController.php
Normal file
40
app/Http/Controllers/Admin/ManageWebsiteController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Frontend\ContactUs;
|
||||
use Mail;
|
||||
use App\Mail\Backend\AdminContactUsMail;
|
||||
|
||||
class ManageWebsiteController extends Controller {
|
||||
|
||||
public function index() {
|
||||
$contact_us = ContactUs::all()->toArray();
|
||||
return view('Admin.Pages.manage_website_contact.manage_website_contact_us')->with(['contact_us' => $contact_us]);
|
||||
}
|
||||
|
||||
public function send_contact(Request $request) {
|
||||
|
||||
$mailData = [
|
||||
'title' => 'Mail from Lean in World',
|
||||
'body' => $request->message,
|
||||
'name' => $request->name,
|
||||
'email' => $request->email_id
|
||||
];
|
||||
|
||||
$check = Mail::to($request->email_id)->send(new AdminContactUsMail($mailData));
|
||||
$rating = ContactUs::where('email', $request->email_id)->first();
|
||||
$rating->is_replay = 1;
|
||||
$rating->save();
|
||||
|
||||
return response()->json(['success' => true,'status'=>200]);
|
||||
|
||||
}
|
||||
|
||||
public function delete_contact($id) {
|
||||
$contact = ContactUs::find($id)->delete();
|
||||
}
|
||||
|
||||
}
|
||||
42
app/Http/Controllers/Admin/MessageBoardController.php
Normal file
42
app/Http/Controllers/Admin/MessageBoardController.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\program;
|
||||
use App\Models\Admin\message_board;
|
||||
|
||||
class MessageBoardController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$program = program::all()->toArray();
|
||||
$message_board = message_board::all()->toArray();
|
||||
// dd($message_board);
|
||||
return view('Admin.Pages.manage_message_board.message_board')->with(['programs' =>$program,'message_board'=> $message_board]);
|
||||
}
|
||||
|
||||
public function insert(Request $request)
|
||||
{
|
||||
$message = new message_board;
|
||||
$message->message = $request->input('message_board');
|
||||
$message->programs_xid = $request->input('program');
|
||||
$message->save();
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
$message = message_board::find($id)->delete();
|
||||
}
|
||||
|
||||
public function update(Request $request)
|
||||
{
|
||||
$message = message_board::find($request->message_id);
|
||||
$message->message = $request->input('edit_message_board');
|
||||
$message->programs_xid = $request->input('category_id');
|
||||
$message->save();
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
}
|
||||
152
app/Http/Controllers/Admin/PaymentController.php
Normal file
152
app/Http/Controllers/Admin/PaymentController.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Mollie\Laravel\Facades\Mollie;
|
||||
use Mollie\Api\Exceptions\ApiException;
|
||||
use Mollie\Api\MollieApiClient;
|
||||
use App\Models\Frontend\payment_transaction_master;
|
||||
use App\Models\Admin\program;
|
||||
use App\Models\Admin\country;
|
||||
use App\Exports\UsersExport;
|
||||
use Carbon\Carbon;
|
||||
use PDF;
|
||||
use Excel;
|
||||
|
||||
class PaymentController extends Controller {
|
||||
|
||||
public function index() {
|
||||
$weekAgo = Carbon::now()->subWeek();
|
||||
$latest_payments = payment_transaction_master::with('user', 'Programs.programe_country')
|
||||
->where('created_at', '>=', $weekAgo) // Filter transactions from the last week
|
||||
->orderByDesc('created_at')
|
||||
->get()
|
||||
->toArray();
|
||||
$register_payments = payment_transaction_master::with('user', 'Programs.programe_country')
|
||||
->where('payment_status', 1)
|
||||
->get()
|
||||
->toArray();
|
||||
$volunteer_payments = payment_transaction_master::with('user', 'Programs.programe_country')
|
||||
->where('payment_status', 2)
|
||||
->get()
|
||||
->toArray();
|
||||
$country = country::all()->toArray();
|
||||
// dd($latest_payments,$register_payments,$volunteer_payments);
|
||||
return view('Admin.Pages.manage_payments.manage_payment')->with(['latest_pay' => $latest_payments, 'regi_pay' => $register_payments, 'vol_pay' => $volunteer_payments, 'country' => $country]);
|
||||
}
|
||||
|
||||
public function createPayment(Request $request) {
|
||||
// dd($request->all());
|
||||
$paymentAmount = $request->query('payment_amount');
|
||||
$convertName = $request->query('selected_currency');
|
||||
$redirect_url = $request->query('redirect_url');
|
||||
$programId = $request->query('pro_id');
|
||||
$programWeek = $request->query('selected_week');
|
||||
$p_start_date = $request->query('start_date');
|
||||
$url = url($redirect_url);
|
||||
|
||||
$metadata = [
|
||||
'prog_id' => $programId,
|
||||
'prog_week' => $programWeek,
|
||||
'prog_start_date' => $p_start_date,
|
||||
];
|
||||
// dd($metadata);
|
||||
// dd($paymentAmount,$convertName,$redirect_url,$url,$progs_id,$progs_week,$p_start_date,$p_end_date);
|
||||
$payment = Mollie::api()->payments()->create([
|
||||
'amount' => [
|
||||
'currency' => $convertName,
|
||||
'value' => $paymentAmount
|
||||
],
|
||||
'metadata' => $metadata,
|
||||
'description' => 'Test payment',
|
||||
'redirectUrl' => $url
|
||||
]);
|
||||
|
||||
session(['transaction_id' => $payment->id]);
|
||||
$redirectUrl = $payment->getCheckoutUrl();
|
||||
return response()->json(['redirect_url' => $redirectUrl]);
|
||||
|
||||
}
|
||||
|
||||
// public function paymentStatus(Request $request) {
|
||||
// if (session()->has('transaction_id')) {
|
||||
// $transaction_id = session('transaction_id');
|
||||
// }
|
||||
//
|
||||
// $payment = Mollie::api()->payments()->get($transaction_id);
|
||||
//
|
||||
// // Process the payment status
|
||||
// if ($payment->isPaid()) {
|
||||
// // Payment is successful
|
||||
// // Do something here
|
||||
// } elseif ($payment->isOpen()) {
|
||||
// // Payment is still open
|
||||
// // Do something here
|
||||
// } elseif ($payment->isCanceled()) {
|
||||
// // Payment is canceled
|
||||
// // Do something here
|
||||
// }
|
||||
//
|
||||
// return view('payment.status', compact('payment'));
|
||||
// }
|
||||
|
||||
public function download_pdf($id) {
|
||||
try {
|
||||
$latest_payments = payment_transaction_master::with('user', 'Programs.programe_country')
|
||||
->where('id', $id)
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
// $start_date = date('d-m-y', strtotime($latest_payments[0]['programs']['start_date']));
|
||||
if (isset($latest_payments[0]) && isset($latest_payments[0]['programs']) && isset($latest_payments[0]['programs']['start_date'])) {
|
||||
$start_date = date('d-m-y', strtotime($latest_payments[0]['programs']['start_date']));
|
||||
} else {
|
||||
// Set a default value here.
|
||||
$start_date = 'No start date available';
|
||||
}
|
||||
|
||||
// $end_date = date('d-m-y', strtotime($latest_payments[0]['programs']['end_date']));
|
||||
if (isset($latest_payments[0]) && isset($latest_payments[0]['programs']) && isset($latest_payments[0]['programs']['end_date'])) {
|
||||
$end_date = date('d-m-y', strtotime($latest_payments[0]['programs']['end_date']));
|
||||
} else {
|
||||
// Set a default value here.
|
||||
$end_date = 'No end date available';
|
||||
}
|
||||
|
||||
$data = [
|
||||
'title' => 'Payment Invoice',
|
||||
'date' => date('j F Y', strtotime('25 March 2023')),
|
||||
'start_date' => $start_date,
|
||||
'end_date' => $end_date,
|
||||
'latest_payments' => $latest_payments
|
||||
];
|
||||
|
||||
$pdf = PDF::loadView('Admin.Pages.manage_payments.payment_invoice', $data);
|
||||
|
||||
return $pdf->download('invoice.pdf');
|
||||
} catch (Exception $e) {
|
||||
// Handle the exception here, e.g., log it or return an error response.
|
||||
return response()->json(['error' => $e->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------export start here----------------------------------------------------------
|
||||
public function exportUser(Request $request) {
|
||||
$start_date = $request->input('start_date');
|
||||
$end_date = $request->input('end_date');
|
||||
$country_id = $request->input('country_id');
|
||||
|
||||
// Build filters based on the provided parameters
|
||||
$filters = [
|
||||
'start_date' => $start_date,
|
||||
'end_date' => $end_date,
|
||||
'country_id' => $country_id,
|
||||
];
|
||||
|
||||
// Pass the filters to the UsersExport class
|
||||
return Excel::download(new UsersExport($filters), 'users.xlsx');
|
||||
}
|
||||
|
||||
}
|
||||
21
app/Http/Controllers/Admin/UserRatingController.php
Normal file
21
app/Http/Controllers/Admin/UserRatingController.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Frontend\user_rating;
|
||||
|
||||
class UserRatingController extends Controller {
|
||||
|
||||
public function index() {
|
||||
$user_rating = user_rating::with(['user' => function ($query) {
|
||||
$query->select('id', 'first_name','last_name', 'email'); // Specify the columns you want from the User model
|
||||
}])
|
||||
->select('id', 'principal_xid', 'rating') // Specify the columns you want from the UserRating model
|
||||
->get()
|
||||
->toArray();
|
||||
return view('Admin.Pages.user_rating.user_ratings')->with(['user_rate' => $user_rating]);
|
||||
}
|
||||
|
||||
}
|
||||
12
app/Http/Controllers/Controller.php
Normal file
12
app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, ValidatesRequests;
|
||||
}
|
||||
19
app/Http/Controllers/Frontend/AboutUsController.php
Normal file
19
app/Http/Controllers/Frontend/AboutUsController.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\Testimonial;
|
||||
use App\Models\Admin\country;
|
||||
|
||||
class AboutUsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$testimonial = Testimonial::with('country')->get()->toArray();
|
||||
return view('Frontend.Pages.About_us.about_us')->with([
|
||||
'test'=>$testimonial,
|
||||
]);;
|
||||
}
|
||||
}
|
||||
70
app/Http/Controllers/Frontend/ContactUsController.php
Normal file
70
app/Http/Controllers/Frontend/ContactUsController.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Frontend\ContactUs;
|
||||
use App\Models\Admin\contact_us_details;
|
||||
use Mail;
|
||||
use App\Mail\Frontend\ContactUsMail;
|
||||
use App\Mail\Frontend\AdminNotificationEmail;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
|
||||
|
||||
class ContactUsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$contact_us_detail = contact_us_details::all()->toArray();
|
||||
return view('Frontend.Pages.Contact_us.contact_us')->with(['contact_us'=>$contact_us_detail]);
|
||||
}
|
||||
|
||||
public function index_thank_you()
|
||||
{
|
||||
return view('Frontend.Pages.Contact_us.thank_you_contact');
|
||||
}
|
||||
|
||||
public function insert_contact(Request $request)
|
||||
{
|
||||
$validator = $request->validate([
|
||||
'contact_name' => 'required',
|
||||
'contact_email' => 'required',
|
||||
'contact_title' => 'required',
|
||||
'captcha' => 'required|captcha'
|
||||
],[
|
||||
'captcha.required' => 'The captcha field is required.',
|
||||
'captcha.captcha' => 'The captcha verification failed.'
|
||||
]);
|
||||
|
||||
$contact = new ContactUs;
|
||||
$contact->name = $request->input('contact_name');
|
||||
$contact->email = $request->input('contact_email');
|
||||
$contact->title = $request->input('contact_title');
|
||||
$contact->message = $request->input('message');
|
||||
$contact->save();
|
||||
//
|
||||
// Mail::to($contact->email)->send(new ContactUsMail($contact));
|
||||
// // Send email to admin
|
||||
// Mail::to('dipti@wdimails.com')->send(new AdminNotificationEmail($contact));
|
||||
//
|
||||
try {
|
||||
// Send email to contact
|
||||
Mail::to($contact->email)->send(new ContactUsMail($contact));
|
||||
|
||||
// Send email to admin
|
||||
Mail::to('sneha@wdimails.com')->send(new AdminNotificationEmail($contact));
|
||||
} catch (\Exception $e) {
|
||||
// Log and handle the exception
|
||||
\Log::error('Email sending failed: ' . $e->getMessage());
|
||||
}
|
||||
// Return success response
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
public function reloadCaptcha()
|
||||
{
|
||||
return response()->json(['captcha'=> captcha_img('flat')]);
|
||||
}
|
||||
}
|
||||
26
app/Http/Controllers/Frontend/FaqsController.php
Normal file
26
app/Http/Controllers/Frontend/FaqsController.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\faq;
|
||||
use App\Models\Admin\country;
|
||||
|
||||
class FaqsController extends Controller {
|
||||
|
||||
public function index() {
|
||||
$faq = Faq::where('country_xid', null)->get()->toArray();
|
||||
$countries = country::all()->toArray();
|
||||
return view('Frontend.Pages.Faqs.faq')->with(['faqs' => $faq, 'country' => $countries]);
|
||||
}
|
||||
|
||||
|
||||
public function get_faq($id) {
|
||||
$faqs = faq::where('country_xid', $id)->get();
|
||||
|
||||
return response()->json(['faqs' => $faqs]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
159
app/Http/Controllers/Frontend/HomeController.php
Normal file
159
app/Http/Controllers/Frontend/HomeController.php
Normal file
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\program;
|
||||
use App\Models\Admin\country;
|
||||
use App\Models\Admin\faq;
|
||||
use App\Models\Admin\blog_category;
|
||||
use App\Models\Admin\blog;
|
||||
use App\Models\Admin\Testimonial;
|
||||
use App\Models\Frontend\news_letter;
|
||||
use App\Models\Frontend\user_rating;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use App\Models\Admin\latest_update;
|
||||
|
||||
//use League\CommonMark\Attributes\Country;
|
||||
|
||||
|
||||
class HomeController extends Controller {
|
||||
|
||||
|
||||
public function index() {
|
||||
$show_program = Program::where('is_active', 1)->get()->toArray();
|
||||
$user_rating = user_rating::all()->toArray();
|
||||
$show_countries = country::all()->toArray();
|
||||
$latestFaqs = FAQ::latest()->limit(5)->get();
|
||||
$blog_one = blog::latest()->limit(1)->get();
|
||||
$blog_three = blog::latest()->limit(3)->get();
|
||||
$blog_categ = blog_category::latest()->limit(2)->get()->toArray();
|
||||
$testimonial = Testimonial::with('country')->get()->toArray();
|
||||
$country_count = country::count();
|
||||
|
||||
return view('Frontend.Pages.Home.home')
|
||||
->with([
|
||||
'program' => $show_program,
|
||||
'country' => $show_countries,
|
||||
'faq' => $latestFaqs,
|
||||
'blog_singal' => $blog_one,
|
||||
'blog_muilti' => $blog_three,
|
||||
'blog_category' => $blog_categ,
|
||||
'test' => $testimonial,
|
||||
'user_rate' => $user_rating,
|
||||
'country_count' => $country_count,
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
public function getCountryFlag($countryCode) {
|
||||
$flag = Country::getEmojiFlag($countryCode);
|
||||
return $flag;
|
||||
}
|
||||
|
||||
public function get_countries() {
|
||||
$show_countries = Country::all(['country_code', 'name'])->toArray();
|
||||
|
||||
$countryData = collect($show_countries)->map(function ($item) {
|
||||
return [
|
||||
'id' => $item['country_code'],
|
||||
'text' => $item['name']
|
||||
];
|
||||
});
|
||||
|
||||
return response()->json($countryData);
|
||||
}
|
||||
|
||||
public function home_get_programs(Request $request) {
|
||||
$country_code = $request->input('country_code');
|
||||
|
||||
$country = Country::where('country_code', $country_code)->first()->toArray();
|
||||
// dd($country_code,$query->toSql(), $query->getBindings());
|
||||
$countryId = $country['id'];
|
||||
|
||||
$programs = Program::where('country_xid', $countryId)
|
||||
->where('is_active', 1)
|
||||
->get(['id', 'program_title', 'thumbnail'])
|
||||
->toArray();
|
||||
// dd($programs);
|
||||
return response()->json([
|
||||
'programs' => $programs,
|
||||
]);
|
||||
}
|
||||
|
||||
// public function insert_newsletter(Request $request) {
|
||||
// $existingEmail = news_letter::where('email', $request->input('email_id'))->first();
|
||||
// if ($existingEmail) {
|
||||
// return response()->json(['success' => false, 'status' => 400, 'message' => 'Email already exists. Please choose a different email']);
|
||||
// }
|
||||
//
|
||||
// $add_newsletter_data = new news_letter;
|
||||
// $add_newsletter_data->first_name = $request->input('first_name');
|
||||
// $add_newsletter_data->email = $request->input('email');
|
||||
// $add_newsletter_data->save();
|
||||
//
|
||||
// return response()->json(['success' => true, 'status' => 200, 'message' => 'Newsletter added successfully']);
|
||||
//}
|
||||
|
||||
public function insert_newsletter(Request $request) {
|
||||
try {
|
||||
$existingEmail = news_letter::where('email', $request->input('email_id'))->first();
|
||||
if ($existingEmail) {
|
||||
return response()->json(['success' => false, 'status' => 400, 'message' => 'Email already exists. Please choose a different email']);
|
||||
}
|
||||
$add_newsletter_data = new news_letter;
|
||||
$add_newsletter_data->first_name = $request->input('first_name');
|
||||
$add_newsletter_data->email = trim($request->input('email'));
|
||||
$add_newsletter_data->save();
|
||||
return response()->json(['success' => true, 'status' => 200, 'message' => 'Newsletter added successfully']);
|
||||
} catch (QueryException $e) {
|
||||
if ($e->errorInfo[1] == 1062) {
|
||||
// Handle unique constraint violation exception (error code 1062)
|
||||
return response()->json(['success' => false, 'status' => 400, 'message' => 'Email already exists. Please choose a different email']);
|
||||
}
|
||||
// Handle other database-related exceptions if necessaryl']);
|
||||
return response()->json(['success' => false, 'status' => 500, 'message' => 'Database error occurred. Please try again later.']);
|
||||
}
|
||||
}
|
||||
|
||||
public function view_newsletter() {
|
||||
|
||||
$view_newsletter_data = news_letter::all()->toArray();
|
||||
// dd($view_newsletter_data);
|
||||
return view('Admin.Pages.manage_newsletter.manage_newsletter', ['newsletter' => $view_newsletter_data]);
|
||||
}
|
||||
|
||||
public function store_rating(Request $request) {
|
||||
// Check if the user is authenticated
|
||||
if (!auth()->check()) {
|
||||
return response()->json(['success' => false, 'status' => 401]);
|
||||
}
|
||||
|
||||
$userIds = auth()->id();
|
||||
|
||||
// Data to be inserted or updated
|
||||
$data = [
|
||||
'principal_xid' => $userIds,
|
||||
'rating' => $request->input('star-rating'),
|
||||
];
|
||||
|
||||
// Use updateOrInsert to update or insert the rating
|
||||
user_rating::updateOrInsert(
|
||||
['principal_xid' => $userIds], $data
|
||||
);
|
||||
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
public function programs_by_country($countryId) {
|
||||
$country = Country::with(['programs' => function($query) {
|
||||
$query->where('is_active', 1);
|
||||
}])->findOrFail($countryId);
|
||||
|
||||
return response()->json(['program_country' => $country]);
|
||||
}
|
||||
|
||||
}
|
||||
41
app/Http/Controllers/Frontend/LatestNewsController.php
Normal file
41
app/Http/Controllers/Frontend/LatestNewsController.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\blog;
|
||||
use App\Models\Admin\blog_category;
|
||||
|
||||
|
||||
class LatestNewsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
// $blog_categ = blog_category::all()->toArray();
|
||||
$blog_categ = blog_category::latest()->limit(2)->get()->toArray();
|
||||
$blogs = blog::latest()->get()->toArray();
|
||||
// dd($blog_categ);
|
||||
return view('Frontend.Pages.Latest_news.latest_news')->with(['blog'=>$blogs,'blog_categs'=>$blog_categ]);
|
||||
}
|
||||
|
||||
public function blog_detail($id)
|
||||
{
|
||||
$blog_three = blog::latest()->limit(3)->get();
|
||||
$blog = blog::find($id)->toArray();
|
||||
$blog_categ = blog_category::all()->toArray();
|
||||
return view('Frontend.Pages.Latest_news.latest_news_detail')->with(['blog'=>$blog,'blog_categs'=>$blog_categ,'latest_blog'=>$blog_three]);
|
||||
}
|
||||
|
||||
public function index_categ($id)
|
||||
{
|
||||
$categ_with_blog = blog_category::with('blog')
|
||||
->where('id',$id)
|
||||
->get()
|
||||
->toArray();
|
||||
// echo "<pre>"; print_r($categ_with_blog);exit;
|
||||
return view('Frontend.Pages.Latest_news.latest_news_categ')->with(['categ_blog'=>$categ_with_blog]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
261
app/Http/Controllers/Frontend/LoginController.php
Normal file
261
app/Http/Controllers/Frontend/LoginController.php
Normal file
@@ -0,0 +1,261 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\program;
|
||||
use App\Models\Admin\country;
|
||||
use App\Models\Admin\ProgramCurrencyAmount;
|
||||
use App\Models\Frontend\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Mail;
|
||||
use App\Mail\Frontend\RegisterationMail;
|
||||
use App\Mail\Frontend\PasswordResetMail;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Carbon\Carbon;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use AmrShawky\LaravelCurrency\Facade\Currency;
|
||||
|
||||
class LoginController extends Controller {
|
||||
|
||||
public function index() {
|
||||
$get_program = program::all()->toArray();
|
||||
$get_countries = country::all()->toArray();
|
||||
return view('Frontend.Pages.Login.login')->with(['programs' => $get_program, 'get_country' => $get_countries]);
|
||||
}
|
||||
|
||||
public function insert_user_data(Request $request) {
|
||||
|
||||
// Check if the email already exists in the database
|
||||
$existingUser = User::where('email', $request->input('email_id'))->first();
|
||||
|
||||
if ($existingUser) {
|
||||
return response()->json(['success' => false, 'status' => 400, 'message' => 'Email already exists. Please choose a different email']);
|
||||
}
|
||||
|
||||
$user_data = new User;
|
||||
$user_data->first_name = $request->input('first_name');
|
||||
$user_data->last_name = $request->input('last_name');
|
||||
$user_data->email = $request->input('email_id');
|
||||
$user_data->password = Hash::make($request->input('password1'));
|
||||
$user_data->phone_number = $request->input('phone_number');
|
||||
$user_data->gender = $request->input('gender');
|
||||
$user_data->date_of_birth = $request->input('date_of_birth');
|
||||
$user_data->address_line1 = $request->input('address');
|
||||
$user_data->city = $request->input('city');
|
||||
$user_data->state = $request->input('state');
|
||||
$user_data->country = $request->input('manual_countries');
|
||||
$user_data->post_code = $request->input('zip_code');
|
||||
|
||||
$user_data->lang_level = $request->input('lang_level');
|
||||
$user_data->hear_about_us = $request->input('hear_about');
|
||||
$user_data->motivation_to_join_program = $request->input('describe');
|
||||
$user_data->any_comment = $request->input('comment');
|
||||
$user_data->save();
|
||||
|
||||
|
||||
Mail::to($user_data->email)->send(new RegisterationMail($user_data));
|
||||
|
||||
$credetials = [
|
||||
'email' => $request->input('email_id'),
|
||||
'password' => $request->input('password'),
|
||||
];
|
||||
Auth::login($user_data);
|
||||
// dd(auth()->user()->id);
|
||||
$user_id = auth()->user()->id;
|
||||
// if (Auth::login($user_data)) {
|
||||
return response()->json(['success' => true, 'status' => 200,'user_id' => $user_id]);
|
||||
// }
|
||||
}
|
||||
|
||||
public function login_user(Request $request) {
|
||||
$credetials = [
|
||||
'email' => $request->email,
|
||||
'password' => $request->password,
|
||||
];
|
||||
|
||||
if (Auth::attempt($credetials)) {
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
} else {
|
||||
return response()->json(['error' => 'Invalid Credentials', 'status' => 401]);
|
||||
}
|
||||
}
|
||||
|
||||
public function forgot_password() {
|
||||
return view('Frontend.Pages.Login.forgot_password');
|
||||
}
|
||||
|
||||
public function add_forgot_password(Request $request) {
|
||||
|
||||
$user = DB::table('iam_principal')->where('email', $request->email)->first();
|
||||
|
||||
if (!$user) {
|
||||
return response()->json(['error' => 'Email not found.', 'status' => 404]);
|
||||
}
|
||||
|
||||
$token = Str::random(64);
|
||||
$expirationTime = now()->addMinutes(5);
|
||||
|
||||
$data = [
|
||||
'email' => $request->email,
|
||||
'token' => $token,
|
||||
'expires_at' => $expirationTime,
|
||||
'created_at' => Carbon::now(),
|
||||
];
|
||||
$user_token = DB::table('password_reset_tokens')->where('email', $request->email)->first();
|
||||
if ($user_token) {
|
||||
DB::table('password_reset_tokens')
|
||||
->where('email', $request->email)
|
||||
->update($data);
|
||||
} else {
|
||||
DB::table('password_reset_tokens')
|
||||
->insert($data);
|
||||
}
|
||||
|
||||
|
||||
// Mail::send('Frontend.Templates.forgot_password', ['token' => $token], function($message) use ($request) {
|
||||
// $message->to($request->email);
|
||||
// $message->subject("Reset Password");
|
||||
// });
|
||||
// dd($data);
|
||||
Mail::to($request->email)->send(new PasswordResetMail($data));
|
||||
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
public function resend_link(Request $request) {
|
||||
$token = Str::random(64);
|
||||
$expirationTime = now()->addMinutes(5);
|
||||
|
||||
$data = [
|
||||
'email' => $request->email,
|
||||
'token' => $token,
|
||||
'expires_at' => $expirationTime,
|
||||
'created_at' => Carbon::now(),
|
||||
];
|
||||
|
||||
$user_token = DB::table('password_reset_tokens')->where('email', $request->email)->first();
|
||||
// dd($user_token);
|
||||
if ($user_token) {
|
||||
DB::table('password_reset_tokens')
|
||||
->where('email', $request->email)
|
||||
->update($data);
|
||||
} else {
|
||||
DB::table('password_reset_tokens')
|
||||
->insert($data);
|
||||
}
|
||||
|
||||
|
||||
// Mail::send('Frontend.Templates.forgot_password', ['token' => $token], function($message) use ($request) {
|
||||
// $message->to($request->email);
|
||||
// $message->subject("Reset Password");
|
||||
// });
|
||||
Mail::to($request->email)->send(new PasswordResetMail($token));
|
||||
|
||||
return response()->json(['success' => true, 'status' => 200, 'message' => 'A new password reset link has been sent to your email.']);
|
||||
}
|
||||
|
||||
public function change_password() {
|
||||
return view('Frontend.Pages.Login.reset_new_password');
|
||||
}
|
||||
|
||||
public function password_set($token) {
|
||||
return view('Frontend.Pages.Login.set_password')->with(['token' => $token]);
|
||||
}
|
||||
|
||||
public function confirm_forgot_password(Request $request) {
|
||||
$updatePassword = DB::table('password_reset_tokens')
|
||||
->where([
|
||||
'email' => $request->email,
|
||||
'token' => $request->token,
|
||||
])
|
||||
->first();
|
||||
|
||||
if (!$updatePassword) {
|
||||
return response()->json(['status' => 401, 'message' => 'Invalid or expired token']);
|
||||
}
|
||||
|
||||
// Check if the token has expired
|
||||
if (Carbon::now()->diffInMinutes($updatePassword->expires_at) > 0) {
|
||||
return response()->json(['status' => 401, 'message' => 'Token has expired']);
|
||||
}
|
||||
|
||||
User::where('email', $request->email)
|
||||
->update(['password' => Hash::make($request->password)]);
|
||||
|
||||
DB::table('password_reset_tokens')
|
||||
->where(['email' => $request->email])
|
||||
->delete();
|
||||
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
}
|
||||
|
||||
public function page_check_email() {
|
||||
return view('Frontend.Pages.Login.check_password_reset_mail');
|
||||
}
|
||||
|
||||
public function success_password_reset() {
|
||||
return view('Frontend.Pages.Login.success_password_reset');
|
||||
}
|
||||
|
||||
public function get_programs(Request $request) {
|
||||
$countryId = $request->input('country_id');
|
||||
$programs = Program::where('country_xid', $countryId)->get();
|
||||
return response()->json(['programs' => $programs]);
|
||||
}
|
||||
|
||||
public function get_single_program_detail(Request $request) {
|
||||
$programId = $request->input('program_id');
|
||||
// Fetch the program details based on the selected program ID
|
||||
$program = Program::find($programId);
|
||||
return response()->json(['program' => $program]);
|
||||
}
|
||||
|
||||
public function fetch_converted_amount(Request $request) {
|
||||
$convert_to = $request->input('convert_to');
|
||||
|
||||
if ($convert_to == 1) {
|
||||
$convert_name = 'USD';
|
||||
} else if ($convert_to == 2) {
|
||||
$convert_name = 'GBP';
|
||||
} else {
|
||||
$convert_name = 'EUR';
|
||||
}
|
||||
|
||||
// $converted = Currency::convert()
|
||||
// ->from('GBP')
|
||||
// ->to($convert_name)
|
||||
// ->amount(152.60)
|
||||
// ->get();
|
||||
|
||||
$fromCurrency = 'GBP';
|
||||
$gbp_price = 200;
|
||||
$apiKey = config('services.exchangerates.api_key');
|
||||
$baseUrl = 'https://api.apilayer.com/exchangerates_data_api/latest';
|
||||
|
||||
$client = new Client();
|
||||
// $response = $client->get("{$baseUrl}?access_key={$apiKey}");
|
||||
$response = \Http::get('https://api.freecurrencyapi.com/v1/latest?apikey=fca_live_IUpn22wjq5zhcvRqGix4k6FlOZKo9SOHSAobRtMd');
|
||||
$data = json_decode($response->getBody(), true);
|
||||
// echo "<pre>";
|
||||
// print_r($data['data']);
|
||||
// die;
|
||||
|
||||
$conversionRate = $data['data'][$convert_name] / $data['data'][$fromCurrency];
|
||||
$convertedAmount = $gbp_price * $conversionRate;
|
||||
|
||||
return response()->json([
|
||||
'converted_amount' => $convertedAmount
|
||||
]);
|
||||
}
|
||||
|
||||
public function logout() {
|
||||
Auth::logout();
|
||||
return redirect('/website_login');
|
||||
}
|
||||
|
||||
}
|
||||
41
app/Http/Controllers/Frontend/PaymentController.php
Normal file
41
app/Http/Controllers/Frontend/PaymentController.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Mollie\Laravel\Facades\Mollie;
|
||||
|
||||
class PaymentController extends Controller
|
||||
{
|
||||
public function createPayment()
|
||||
{
|
||||
$payment = Mollie::api()->payments()->create([
|
||||
'amount' => [
|
||||
'currency' => 'EUR',
|
||||
'value' => '10.00', // The payment amount
|
||||
],
|
||||
'description' => 'Test payment',
|
||||
'redirectUrl' => route('payment.status'),
|
||||
]);
|
||||
|
||||
// Redirect the user to the Mollie payment page
|
||||
return redirect($payment->getCheckoutUrl());
|
||||
}
|
||||
|
||||
public function paymentStatus()
|
||||
{
|
||||
$paymentId = request()->input('id');
|
||||
|
||||
$payment = Mollie::api()->payments()->get($paymentId);
|
||||
|
||||
// Check the payment status
|
||||
if ($payment->status === 'paid') {
|
||||
// Payment is successful
|
||||
return 'Payment successful';
|
||||
} else {
|
||||
// Payment failed
|
||||
return 'Payment failed';
|
||||
}
|
||||
}
|
||||
}
|
||||
17
app/Http/Controllers/Frontend/PrivacyPolicyController.php
Normal file
17
app/Http/Controllers/Frontend/PrivacyPolicyController.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\privacy_policy;
|
||||
|
||||
|
||||
class PrivacyPolicyController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$privacy = privacy_policy::all()->toArray();
|
||||
return view('Frontend.Pages.Privacy_policy.privacy_policy')->with(['privacy'=> $privacy]);
|
||||
}
|
||||
}
|
||||
170
app/Http/Controllers/Frontend/ProfileController.php
Normal file
170
app/Http/Controllers/Frontend/ProfileController.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Frontend\User;
|
||||
use App\Models\Frontend\volunteer_profile_document;
|
||||
use App\Models\Profile;
|
||||
use Mollie\Laravel\Facades\Mollie;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\Admin\faq;
|
||||
use App\Models\Frontend\payment_transaction_master;
|
||||
use App\Models\Admin\blog_category;
|
||||
use App\Models\Admin\blog;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
public function view_profile()
|
||||
{
|
||||
if (session()->has("transaction_id")) {
|
||||
$transaction_id = session("transaction_id");
|
||||
$payment = payment_transaction_master::where(
|
||||
"transaction_id",
|
||||
$transaction_id
|
||||
)->first();
|
||||
if (!$payment) {
|
||||
$payment_details = Mollie::api()
|
||||
->payments()
|
||||
->get($transaction_id);
|
||||
// dd($payment_details);
|
||||
// Process the payment status
|
||||
if ($payment_details->isPaid()) {
|
||||
$payment = new payment_transaction_master();
|
||||
$payment->programs_xid = $payment_details->metadata->prog_id;
|
||||
$pay_start_date = $payment_details->metadata->prog_start_date;
|
||||
$newDateFormat = Carbon::createFromFormat('m/d/Y', $pay_start_date)->format('Y-m-d');
|
||||
$payment->start_date = $newDateFormat;
|
||||
$payment->duration = $payment_details->metadata->prog_week;
|
||||
$payment->principal_xid = auth()->user()->id;
|
||||
$payment->transaction_id = $payment_details->id;
|
||||
$payment->amount = $payment_details->amount->value;
|
||||
$payment->payment_status = 2;
|
||||
if ($payment_details->amount->currency == "USD") {
|
||||
$currency = "1";
|
||||
} elseif ($payment_details->amount->currency == "GBP") {
|
||||
$currency = "2";
|
||||
} else {
|
||||
$currency = "3";
|
||||
}
|
||||
$payment->currency = $currency;
|
||||
$payment->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$users = auth()->user();
|
||||
$users->load([
|
||||
'paymentTransactions.Programs.programe_acomadation',
|
||||
'paymentTransactions.Programs.programe_country'
|
||||
]);
|
||||
|
||||
$users_data = $users->toArray();
|
||||
$latestFaqs = FAQ::latest()
|
||||
->limit(4)
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
return view("Frontend.Pages.User_profile.profile")->with([
|
||||
"user" => $users_data,
|
||||
"faq" => $latestFaqs,
|
||||
]);
|
||||
}
|
||||
|
||||
public function clear_volunteer(Request $request) {
|
||||
$request->session()->forget('transaction_id');
|
||||
return response()->json(['success' => true]);
|
||||
}
|
||||
|
||||
public function detail_profile()
|
||||
{
|
||||
$users = auth()->user();
|
||||
$users->load("user_documents");
|
||||
$users->toArray();
|
||||
|
||||
$latestFaqs = FAQ::latest()
|
||||
->limit(4)
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
$blog_three = blog::latest()->limit(3)->get();
|
||||
$blog_categ = blog_category::latest()->limit(2)->get()->toArray();
|
||||
|
||||
return view("Frontend.Pages.User_profile.my_profile")->with([
|
||||
"user" => $users,
|
||||
"faq" => $latestFaqs,
|
||||
'blog_muilti' => $blog_three,
|
||||
'blog_category' => $blog_categ,
|
||||
]);
|
||||
}
|
||||
|
||||
public function update_profile(Request $request)
|
||||
{
|
||||
$user = User::find($request->profile_id);
|
||||
$user->first_name = $request->input("first_name");
|
||||
$user->last_name = $request->input("last_name");
|
||||
$user->date_of_birth = $request->input("birth_date");
|
||||
$user->gender = $request->input("gender");
|
||||
|
||||
if ($request->hasFile("profile_photo")) {
|
||||
// Handle profile photo upload
|
||||
$profilePhoto = $request->file("profile_photo");
|
||||
$profilePhotoName = $request->profile_id . '_' . time() . '.' . $profilePhoto->getClientOriginalExtension();
|
||||
$profilePhotoPath = public_path('assets/uploads/profile_images/');
|
||||
$profilePhoto->move($profilePhotoPath, $profilePhotoName);
|
||||
$user->profile_photo = $profilePhotoName;
|
||||
}
|
||||
|
||||
$user->save();
|
||||
|
||||
// Handle image removal
|
||||
$imagesToRemove = $request->input('images_to_remove')[0];
|
||||
|
||||
if (!empty($imagesToRemove)) {
|
||||
$imagesToRemoveJson = json_decode($imagesToRemove);
|
||||
|
||||
foreach ($imagesToRemoveJson as $imageId) {
|
||||
$userFile = volunteer_profile_document::find($imageId);
|
||||
|
||||
if ($userFile) {
|
||||
$file_path = public_path($userFile->profile_documents);
|
||||
|
||||
if (file_exists($file_path)) {
|
||||
unlink($file_path);
|
||||
}
|
||||
|
||||
$userFile->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle multiple image uploads
|
||||
if ($request->hasFile("images")) {
|
||||
$number = 0;
|
||||
foreach ($request->file("images") as $file) {
|
||||
// Handle each uploaded file
|
||||
$ext = $file->extension();
|
||||
$imageName = $request->profile_id . '_' . time() . "_" . $number++ . "." . $ext;
|
||||
$file_path = public_path("assets/uploads/profile_images/user_documents/");
|
||||
|
||||
if ($ext === "pdf") {
|
||||
$file_path = public_path("assets/uploads/profile_images/user_pdf/");
|
||||
}
|
||||
|
||||
$file->move($file_path, $imageName);
|
||||
|
||||
// Save the file details to the "users" table
|
||||
$userFile = new volunteer_profile_document();
|
||||
$userFile->principal_xid = auth()->user()->id; // Assuming this is the user ID
|
||||
$userFile->profile_documents = "assets/uploads/" . ($ext === "pdf" ? "profile_images/user_pdf/" : "profile_images/user_documents/") . $imageName;
|
||||
$userFile->document_type = $ext;
|
||||
$userFile->save();
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json(["success" => true, "status" => 200]);
|
||||
}
|
||||
|
||||
}
|
||||
87
app/Http/Controllers/Frontend/ProgramDetailController.php
Normal file
87
app/Http/Controllers/Frontend/ProgramDetailController.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\program;
|
||||
use App\Models\Admin\Testimonial;
|
||||
use App\Models\Admin\country;
|
||||
use App\Models\Admin\blog_category;
|
||||
use App\Models\Admin\blog;
|
||||
use App\Models\Admin\ProgramCurrencyAmount;
|
||||
use AmrShawky\LaravelCurrency\Facade\Currency;
|
||||
use GuzzleHttp\Client;
|
||||
|
||||
class ProgramDetailController extends Controller {
|
||||
|
||||
public function single_program_detail($id) {
|
||||
// $convert_to = $request->input('convert_to');
|
||||
$testimonial = Testimonial::with('country')
|
||||
->get()
|
||||
->toArray();
|
||||
$blog_three = blog::latest()
|
||||
->limit(3)
|
||||
->get();
|
||||
$blog_categ = blog_category::latest()
|
||||
->limit(2)
|
||||
->get()
|
||||
->toArray();
|
||||
$single_program_details = program::with('programe_amount', 'programe_images','programe_country')
|
||||
->find($id)
|
||||
->toArray();
|
||||
$show_program = program::latest()->limit(2)->get()->toArray();
|
||||
return view('Frontend.Pages.Program.program_detail')
|
||||
->with(['single_program_detail' => $single_program_details,
|
||||
'test' => $testimonial,
|
||||
'programs' => $show_program,
|
||||
'blog_muilti' => $blog_three,
|
||||
'blog_category' => $blog_categ,]);
|
||||
}
|
||||
|
||||
public function fetch_single_prog_currency_amount(Request $request) {
|
||||
$programId = $request->input('program_id');
|
||||
$convert_to = $request->input('convert_to');
|
||||
|
||||
$currency = ProgramCurrencyAmount::where('programs_xid', $programId)
|
||||
->select('usd_price', 'week')
|
||||
->get();
|
||||
|
||||
$convertedAmounts = [];
|
||||
|
||||
foreach ($currency as $data) {
|
||||
$usdPrice = $data->usd_price;
|
||||
$week = $data->week;
|
||||
if ($convert_to == 'One') {
|
||||
$convert_name = 'GBP';
|
||||
} else if ($convert_to == 'Two') {
|
||||
$convert_name = 'USD';
|
||||
} else {
|
||||
$convert_name = 'EUR';
|
||||
}
|
||||
|
||||
|
||||
$fromCurrency = 'GBP';
|
||||
$apiKey = config('services.exchangerates.api_key');
|
||||
$baseUrl = 'https://api.apilayer.com/exchangerates_data_api/latest';
|
||||
|
||||
$client = new Client();
|
||||
// $response = $client->get("{$baseUrl}?access_key={$apiKey}");
|
||||
$response = \Http::get('https://api.freecurrencyapi.com/v1/latest?apikey=fca_live_IUpn22wjq5zhcvRqGix4k6FlOZKo9SOHSAobRtMd');
|
||||
$data = json_decode($response->getBody(), true);
|
||||
|
||||
$conversionRate = $data['data'][$convert_name] / $data['data'][$fromCurrency];
|
||||
$convertedAmount = $usdPrice * $conversionRate;
|
||||
|
||||
|
||||
$convertedAmounts[] = [
|
||||
'week' => $week,
|
||||
'convert_name' => $convert_name,
|
||||
'usd_price' => $usdPrice,
|
||||
'converted_amount' => $convertedAmount
|
||||
];
|
||||
}
|
||||
return response()->json($convertedAmounts);
|
||||
}
|
||||
|
||||
}
|
||||
14
app/Http/Controllers/Frontend/TermsCondtionController.php
Normal file
14
app/Http/Controllers/Frontend/TermsCondtionController.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TermsCondtionController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('Frontend.Pages.Terms_condition.terms_condition');
|
||||
}
|
||||
}
|
||||
266
app/Http/Controllers/Frontend/VolunteerCountriesController.php
Normal file
266
app/Http/Controllers/Frontend/VolunteerCountriesController.php
Normal file
@@ -0,0 +1,266 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\faq;
|
||||
use App\Models\Admin\country;
|
||||
use App\Models\Admin\program;
|
||||
use App\Models\Admin\ProgramCurrencyAmount;
|
||||
use AmrShawky\LaravelCurrency\Facade\Currency;
|
||||
use App\Models\Admin\program_accomadation;
|
||||
use App\Models\Frontend\User;
|
||||
use App\Models\Frontend\iam_principal_group;
|
||||
use App\Models\Frontend\iam_principal_principal_group_link;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\Frontend\payment_transaction_master;
|
||||
use Mollie\Laravel\Facades\Mollie;
|
||||
use Carbon\Carbon;
|
||||
use GuzzleHttp\Client;
|
||||
use App\Mail\Frontend\GroupMemberEmail;
|
||||
use App\Mail\Frontend\sendCancellationEmail;
|
||||
use Mail;
|
||||
|
||||
class VolunteerCountriesController extends Controller {
|
||||
|
||||
public function index() {
|
||||
$userIds = auth()->id();
|
||||
|
||||
if (session()->has('transaction_id')) {
|
||||
$transaction_id = session('transaction_id');
|
||||
|
||||
$payment = payment_transaction_master::where('transaction_id', $transaction_id)->first();
|
||||
|
||||
if (!$payment) {
|
||||
$payment_details = Mollie::api()->payments()->get($transaction_id);
|
||||
if ($payment_details->isPaid()) {
|
||||
// dd(auth()->user()->first_name);
|
||||
$payment = new payment_transaction_master;
|
||||
$payment->principal_xid = auth()->user()->id;
|
||||
$payment->transaction_id = $payment_details->id;
|
||||
$payment->amount = $payment_details->amount->value;
|
||||
$payment->payment_status = 1;
|
||||
$currency = '';
|
||||
switch ($payment_details->amount->currency) {
|
||||
case 'USD':
|
||||
$currency = '1';
|
||||
break;
|
||||
case 'GBP':
|
||||
$currency = '2';
|
||||
break;
|
||||
default:
|
||||
$currency = '3';
|
||||
break;
|
||||
}
|
||||
|
||||
$payment->currency = $currency;
|
||||
if (isset($payment_details->prog_start_date) && isset($payment_details->prog_end_date)) {
|
||||
$payment->start_date = $payment_details->prog_start_date;
|
||||
$payment->end_date = $payment_details->prog_end_date;
|
||||
} else {
|
||||
$payment->start_date = null;
|
||||
$payment->end_date = null;
|
||||
}
|
||||
$payment->save();
|
||||
if ($payment->id) {
|
||||
session()->forget('transaction_id');
|
||||
}
|
||||
} elseif ($payment_details->isCanceled()) {
|
||||
$user_data = auth()->user()->first_name;
|
||||
Mail::to(auth()->user()->email)->send(new sendCancellationEmail($user_data));
|
||||
return response()->json(['error' => 'Payment Failed']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$countries = country::with('programs')->get()->toArray();
|
||||
|
||||
foreach ($countries as $key => $value) {
|
||||
if (isset($value['programs']) && !empty($value['programs'])) {
|
||||
$max_week = max(array_column($value['programs'], 'volunteer_weeks'));
|
||||
$min_week = min(array_column($value['programs'], 'volunteer_weeks'));
|
||||
$max_age = max(array_column($value['programs'], 'age_rules'));
|
||||
|
||||
$countries[$key]['max_min_value'] = $min_week . '-' . $max_week;
|
||||
$countries[$key]['max_age'] = $max_age;
|
||||
}
|
||||
}
|
||||
|
||||
$latestFaqs = FAQ::latest()->limit(5)->get();
|
||||
return view('Frontend.Pages.Volunteer.volunteer_countries')->with([
|
||||
'faqs' => $latestFaqs,
|
||||
'country' => $countries,
|
||||
]);
|
||||
}
|
||||
|
||||
public function clear(Request $request) {
|
||||
$request->session()->forget('transaction_id'); // Replace 'key' with the actual session key you want to clear
|
||||
|
||||
return response()->json(['success' => true]);
|
||||
}
|
||||
|
||||
public function view_country_program($id) {
|
||||
$view_programs = country::with('programs')
|
||||
->where('id', $id)
|
||||
->get()
|
||||
->toArray();
|
||||
// dd($view_programs);
|
||||
return view('Frontend.Pages.Volunteer.volunteer_countries_program')->with(['view_program' => $view_programs]);
|
||||
}
|
||||
|
||||
public function view_country_program_detail($id) {
|
||||
$view_programs_detail = program::with('programe_amount', 'programe_country', 'programe_acomadation')
|
||||
->find($id)
|
||||
->toArray();
|
||||
// dd($view_programs_detail);
|
||||
return view('Frontend.Pages.Volunteer.volunteer_countries_program_detail')->with(['view_programs_detail' => $view_programs_detail]);
|
||||
}
|
||||
|
||||
public function fetch_progm_currency_amount(Request $request) {
|
||||
$durationId = $request->input('duration_id');
|
||||
$programId = $request->input('program_id');
|
||||
$convert_to = $request->input('convert_to');
|
||||
$start_date = $request->input('start_date');
|
||||
$end_date = $request->input('end_date');
|
||||
$total_weeks = $request->input('total_week');
|
||||
|
||||
$currency = ProgramCurrencyAmount::where('week', $durationId)
|
||||
->where('programs_xid', $programId)
|
||||
->pluck('usd_price');
|
||||
|
||||
$usdPrice = $currency[0];
|
||||
|
||||
if ($convert_to == 1) {
|
||||
$convert_name = 'USD';
|
||||
} else if ($convert_to == 2) {
|
||||
$convert_name = 'GBP';
|
||||
} else {
|
||||
$convert_name = 'EUR';
|
||||
}
|
||||
|
||||
|
||||
$fromCurrency = 'GBP';
|
||||
$apiKey = config('services.exchangerates.api_key');
|
||||
$baseUrl = 'https://api.apilayer.com/exchangerates_data_api/latest';
|
||||
|
||||
$client = new Client();
|
||||
// $response = $client->get("{$baseUrl}?access_key={$apiKey}");
|
||||
$response = \Http::get('https://api.freecurrencyapi.com/v1/latest?apikey=fca_live_IUpn22wjq5zhcvRqGix4k6FlOZKo9SOHSAobRtMd');
|
||||
$data = json_decode($response->getBody(), true);
|
||||
// echo "<pre>";
|
||||
// print_r($data['data']);
|
||||
// die;
|
||||
|
||||
$conversionRate = $data['data'][$convert_name] / $data['data'][$fromCurrency];
|
||||
$convertedAmount = $usdPrice * $conversionRate;
|
||||
|
||||
return response()->json([
|
||||
'usd_price' => $usdPrice,
|
||||
'selected_currency' => $convert_to,
|
||||
'converted_amount' => $convertedAmount,
|
||||
'start_date' => $start_date,
|
||||
'end_date' => $end_date,
|
||||
'week' => $durationId,
|
||||
'total_week' => $total_weeks
|
||||
]);
|
||||
// } catch (\Exception $e) {
|
||||
// return response()->json(['error' => 'Currency conversion failed']);
|
||||
// }
|
||||
}
|
||||
|
||||
public function insert_volunteer_program_detail(Request $request) {
|
||||
if (Auth::check()) {
|
||||
$program_age = $request->program_age;
|
||||
$user_age = Auth::user()->date_of_birth;
|
||||
$userDateOfBirth = Carbon::parse($user_age);
|
||||
$currentDate = Carbon::now();
|
||||
$userAge = $userDateOfBirth->diffInYears($currentDate);
|
||||
|
||||
// Check if the user's age matches the program age
|
||||
if ($userAge >= $program_age) {
|
||||
$userId = Auth::user()->id;
|
||||
$user_fname = Auth::user()->first_name;
|
||||
$user_lname = Auth::user()->last_name;
|
||||
$iam_principal_group = new iam_principal_group;
|
||||
$iam_principal_group->programs_xid = $request->input('program_id');
|
||||
$program = Program::find($request->input('program_id'));
|
||||
$iam_principal_group->week = $request->input('select_duration');
|
||||
$iam_principal_group->currency = $request->input('convert_to');
|
||||
$iam_principal_group->volunteer_with = $request->input('volunteer');
|
||||
$iam_principal_group->volunteer_group_count = $request->input('member');
|
||||
$iam_principal_group->volunteer_group_name = $request->input('group_name');
|
||||
$startDate = Carbon::createFromFormat('m/d/Y', $request->input('start_date'))->format('d-m-y');
|
||||
$iam_principal_group->start_date = $startDate;
|
||||
$iam_principal_group->group_member_name = json_encode($request->input('group_member_name'));
|
||||
$iam_principal_group->group_member_email = json_encode($request->input('group_member_email'));
|
||||
$iam_principal_group->save();
|
||||
|
||||
$MemberNames = $request->input('group_member_name');
|
||||
$MemberEmails = $request->input('group_member_email');
|
||||
$groupMemberEmails = is_array($MemberEmails) ? $MemberEmails : json_decode($MemberEmails, true);
|
||||
|
||||
Mail::to($groupMemberEmails)->send(new GroupMemberEmail($iam_principal_group,$program,$user_fname,$user_lname));
|
||||
|
||||
$iam_principal_group_link = new iam_principal_principal_group_link;
|
||||
$iam_principal_group_link->principal_xid = $userId;
|
||||
$iam_principal_group_link->principal_group_xid = $iam_principal_group->id;
|
||||
$iam_principal_group_link->save();
|
||||
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
} else {
|
||||
// User's age does not match the program age
|
||||
return response()->json(['error' => 'Your age does not match the program requirements.'], 401);
|
||||
}
|
||||
} else {
|
||||
// The user is not logged in or authenticated
|
||||
$userId = null;
|
||||
return response()->json(['error' => 'Please register to continue using our services.'], 401);
|
||||
}
|
||||
}
|
||||
|
||||
public function volunteer_program_payment(Request $request) {
|
||||
$payment = Mollie::api()->payments()->create([
|
||||
'amount' => [
|
||||
'currency' => 'USD',
|
||||
'value' => '200.00',
|
||||
],
|
||||
'description' => 'Test payment',
|
||||
'redirectUrl' => route('view_volunteer_countries'),
|
||||
]);
|
||||
|
||||
session(['transaction_id' => $payment->id]);
|
||||
return redirect($payment->getCheckoutUrl(), 303);
|
||||
}
|
||||
|
||||
public function paymentStatus(Request $request) {
|
||||
if (session()->has('transaction_id')) {
|
||||
$transaction_id = session('transaction_id');
|
||||
}
|
||||
|
||||
$payment = Mollie::api()->payments()->get($transaction_id);
|
||||
|
||||
// Process the payment status
|
||||
if ($payment->isPaid()) {
|
||||
// Payment is successful
|
||||
// Do something here
|
||||
} elseif ($payment->isOpen()) {
|
||||
// Payment is still open
|
||||
// Do something here
|
||||
} elseif ($payment->isCanceled()) {
|
||||
// Payment is canceled
|
||||
// Do something here
|
||||
}
|
||||
|
||||
return view('payment.status', compact('payment'));
|
||||
}
|
||||
|
||||
public function check_username(Request $request) {
|
||||
$email = $request->input('email');
|
||||
// dd($email);
|
||||
$exists = User::where('email', $email)
|
||||
->exists();
|
||||
return response()->json(['exists' => $exists]);
|
||||
}
|
||||
|
||||
}
|
||||
13
app/Http/Helper.php
Normal file
13
app/Http/Helper.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
use Stidges\CountryFlags\CountryFlag;
|
||||
|
||||
function getCountryFlag($countryCode)
|
||||
{
|
||||
$countryFlag = app(CountryFlag::class);
|
||||
$flagUrl = $countryFlag->get($countryCode);
|
||||
|
||||
return $flagUrl;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
10
app/Http/Helpers/country_flag.php
Normal file
10
app/Http/Helpers/country_flag.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
use Stidges\CountryFlags\CountryFlag;
|
||||
|
||||
function getCountryFlag($countryCode)
|
||||
{
|
||||
$countryFlag = app(CountryFlag::class);
|
||||
$flagUrl = $countryFlag->get($countryCode);
|
||||
|
||||
return $flagUrl;
|
||||
}
|
||||
52
app/Http/Helpers/custom_helper.php
Normal file
52
app/Http/Helpers/custom_helper.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
if (!function_exists('getFlagFilename')) {
|
||||
function getFlagFilename($countryName)
|
||||
{
|
||||
// Define your mapping logic here
|
||||
$countryFlagMap = [
|
||||
'United States' => 'us.svg',
|
||||
'India' => 'in.svg',
|
||||
'Australia' => 'au.svg',
|
||||
'United Kingdom' => 'uk.svg',
|
||||
'Germany' => 'de.svg',
|
||||
'France' => 'fr.svg',
|
||||
'China' => 'cn.svg',
|
||||
'Japan' => 'jp.svg',
|
||||
'Brazil' => 'br.svg',
|
||||
'South Korea' => 'kr.svg',
|
||||
'Italy' => 'it.svg',
|
||||
'Spain' => 'es.svg',
|
||||
'Russia' => 'ru.svg',
|
||||
'Mexico' => 'mx.svg',
|
||||
'Argentina' => 'ar.svg',
|
||||
'Netherlands' => 'nl.svg',
|
||||
'Sweden' => 'se.svg',
|
||||
'Turkey' => 'tr.svg',
|
||||
'Singapore' => 'sg.svg',
|
||||
'Greece' => 'gr.svg',
|
||||
'Norway' => 'no.svg',
|
||||
'Canada' => 'ca.svg',
|
||||
'New Zealand' => 'nz.svg',
|
||||
'Portugal' => 'pt.svg',
|
||||
'Belgium' => 'be.svg',
|
||||
'Europe' => 'europe.svg',
|
||||
'Ireland' => 'ie.svg',
|
||||
'Poland' => 'pl.svg',
|
||||
'Denmark' => 'dk.svg',
|
||||
'Czech Republic' => 'cz.svg',
|
||||
'Hungary' => 'hu.svg',
|
||||
'Finland' => 'fi.svg',
|
||||
'Croatia' => 'hr.svg',
|
||||
'Bulgaria' => 'bg.svg',
|
||||
'Romania' => 'ro.svg',
|
||||
'Ukraine' => 'ua.svg',
|
||||
'Switzerland' => 'ch.svg',
|
||||
'Austria' => 'at.svg',
|
||||
// Add even more countries here
|
||||
];
|
||||
|
||||
|
||||
return isset($countryFlagMap[$countryName]) ? $countryFlagMap[$countryName] : null;
|
||||
}
|
||||
}
|
||||
71
app/Http/Kernel.php
Normal file
71
app/Http/Kernel.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array<int, class-string|string>
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
// \App\Http\Middleware\admin_auth_check::class,
|
||||
// \App\Http\Middleware\WebsiteMiddleware::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Illuminate\Http\Middleware\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array<string, array<int, class-string|string>>
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's middleware aliases.
|
||||
*
|
||||
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
|
||||
*
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $middlewareAliases = [
|
||||
'auth_check' => \App\Http\Middleware\admin_auth_check::class,
|
||||
'website_auth_check' => \App\Http\Middleware\WebsiteMiddleware::class,
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
];
|
||||
}
|
||||
18
app/Http/Middleware/Authenticate.php
Normal file
18
app/Http/Middleware/Authenticate.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*/
|
||||
protected function redirectTo(Request $request): ?string
|
||||
{
|
||||
// dd($request->expectsJson());
|
||||
// return $request->expectsJson() ? null : route('admin_login');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\program;
|
||||
use App\Models\Admin\Testimonial;
|
||||
use App\Models\Admin\country;
|
||||
use App\Models\Admin\blog_category;
|
||||
use App\Models\Admin\blog;
|
||||
use App\Models\Admin\ProgramCurrencyAmount;
|
||||
use AmrShawky\LaravelCurrency\Facade\Currency;
|
||||
|
||||
class ProgramDetailController extends Controller {
|
||||
|
||||
public function single_program_detail($id) {
|
||||
// $convert_to = $request->input('convert_to');
|
||||
$testimonial = Testimonial::with('country')
|
||||
->get()
|
||||
->toArray();
|
||||
$blog_three = blog::latest()
|
||||
->limit(3)
|
||||
->get();
|
||||
$blog_categ = blog_category::latest()
|
||||
->limit(2)
|
||||
->get()
|
||||
->toArray();
|
||||
$single_program_details = program::with('programe_amount', 'programe_images')
|
||||
->find($id)
|
||||
->toArray();
|
||||
$show_program = program::latest()->limit(2)->get()->toArray();
|
||||
// dd($show_program);
|
||||
|
||||
return view('Frontend.Pages.Program.program_detail')
|
||||
->with(['single_program_detail' => $single_program_details,
|
||||
'test' => $testimonial,
|
||||
'programs' => $show_program,
|
||||
'blog_muilti' => $blog_three,
|
||||
'blog_category' => $blog_categ,]);
|
||||
}
|
||||
|
||||
public function fetch_single_prog_currency_amount(Request $request) {
|
||||
$programId = $request->input('program_id');
|
||||
$convert_to = $request->input('convert_to');
|
||||
|
||||
$currency = ProgramCurrencyAmount::where('programs_xid', $programId)
|
||||
->select('usd_price', 'week')
|
||||
->get();
|
||||
|
||||
$convertedAmounts = [];
|
||||
|
||||
foreach ($currency as $data) {
|
||||
$usdPrice = $data->usd_price;
|
||||
$week = $data->week;
|
||||
if ($convert_to == 'One') {
|
||||
$convert_name = 'GBP';
|
||||
} else if ($convert_to == 'Two') {
|
||||
$convert_name = 'USD';
|
||||
} else {
|
||||
$convert_name = 'EUR';
|
||||
}
|
||||
|
||||
$converted = Currency::convert()
|
||||
->from('GBP')
|
||||
->to($convert_name)
|
||||
->amount($usdPrice)
|
||||
->get();
|
||||
|
||||
$convertedAmounts[] = [
|
||||
'week' => $week,
|
||||
'convert_name' => $convert_name,
|
||||
'usd_price' => $usdPrice,
|
||||
'converted_amount' => $converted
|
||||
];
|
||||
}
|
||||
return response()->json($convertedAmounts);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Frontend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Admin\faq;
|
||||
use App\Models\Admin\country;
|
||||
use App\Models\Admin\program;
|
||||
use App\Models\Admin\ProgramCurrencyAmount;
|
||||
use AmrShawky\LaravelCurrency\Facade\Currency;
|
||||
use App\Models\Admin\program_accomadation;
|
||||
use App\Models\Frontend\User;
|
||||
use App\Models\Frontend\iam_principal_group;
|
||||
use App\Models\Frontend\iam_principal_principal_group_link;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\Frontend\payment_transaction_master;
|
||||
use Mollie\Laravel\Facades\Mollie;
|
||||
|
||||
class VolunteerCountriesController extends Controller {
|
||||
|
||||
public function index() {
|
||||
// $userId = auth()->user()->id;
|
||||
$userIds = auth()->id();
|
||||
// $userIdss = (session()->has('id'));
|
||||
// dd($userIds);
|
||||
if (session()->has('transaction_id')) {
|
||||
$transaction_id = session('transaction_id');
|
||||
$payment = payment_transaction_master::where('transaction_id', $transaction_id)->first();
|
||||
if (!$payment) {
|
||||
$payment_details = Mollie::api()->payments()->get($transaction_id);
|
||||
// dd($payment_details->amount->currency);
|
||||
// Process the payment status
|
||||
if ($payment_details->isPaid()) {
|
||||
$payment = new payment_transaction_master;
|
||||
$payment->principal_xid = auth()->user()->id;
|
||||
$payment->transaction_id = $payment_details->id;
|
||||
$payment->amount = $payment_details->amount->value;
|
||||
$payment->payment_status = 1;
|
||||
if ($payment_details->amount->currency == 'USD') {
|
||||
$currency = '1';
|
||||
} elseif ($payment_details->amount->currency == 'GBP') {
|
||||
$currency = '2';
|
||||
} else {
|
||||
$currency = '3';
|
||||
}
|
||||
$payment->currency = $currency;
|
||||
$payment->save();
|
||||
if ($payment->id) {
|
||||
session()->forget('transaction_id');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$countries = country::with('programs')->get()->toArray();
|
||||
// echo "<pre>";print_r($countries);exit;
|
||||
$max_min_value = array();
|
||||
$max_age = array();
|
||||
foreach ($countries as $key => $value) {
|
||||
// dd($value);
|
||||
if (isset($value['programs'])) {
|
||||
$max_week = max(array_column($value['programs'], 'volunteer_weeks'));
|
||||
$min_week = min(array_column($value['programs'], 'volunteer_weeks'));
|
||||
$max_age = max(array_column($value['programs'], 'age_rules'));
|
||||
// $max_min_value[$value['id']] = $min_week.'-'.$max_week;
|
||||
$countries[$key]['max_min_value'] = $min_week . '-' . $max_week;
|
||||
$countries[$key]['max_age'] = $max_age;
|
||||
}
|
||||
}
|
||||
// dd($countries);
|
||||
|
||||
$latestFaqs = FAQ::latest()->limit(5)->get();
|
||||
return view('Frontend.Pages.Volunteer.volunteer_countries')->with(['faqs' => $latestFaqs, 'country' => $countries]);
|
||||
}
|
||||
|
||||
public function view_country_program($id) {
|
||||
$view_programs = country::with('programs')
|
||||
->where('id', $id)
|
||||
->get()
|
||||
->toArray();
|
||||
// dd($view_programs);
|
||||
return view('Frontend.Pages.Volunteer.volunteer_countries_program')->with(['view_program' => $view_programs]);
|
||||
}
|
||||
|
||||
public function view_country_program_detail($id) {
|
||||
$view_programs_detail = program::with('programe_amount', 'programe_country', 'programe_acomadation')
|
||||
->find($id)
|
||||
->toArray();
|
||||
// dd($view_programs_detail);
|
||||
return view('Frontend.Pages.Volunteer.volunteer_countries_program_detail')->with(['view_programs_detail' => $view_programs_detail]);
|
||||
}
|
||||
|
||||
public function fetch_progm_currency_amount(Request $request) {
|
||||
$durationId = $request->input('duration_id');
|
||||
$programId = $request->input('program_id');
|
||||
$convert_to = $request->input('convert_to');
|
||||
$start_date = $request->input('start_date');
|
||||
$end_date = $request->input('end_date');
|
||||
|
||||
$currency = ProgramCurrencyAmount::where('week', $durationId)
|
||||
->where('programs_xid', $programId)
|
||||
->pluck('usd_price');
|
||||
|
||||
$usdPrice = $currency[0];
|
||||
|
||||
if ($convert_to == 1) {
|
||||
$convert_name = 'USD';
|
||||
} else if ($convert_to == 2) {
|
||||
$convert_name = 'GBP';
|
||||
} else {
|
||||
$convert_name = 'EUR';
|
||||
}
|
||||
|
||||
$converted = Currency::convert()
|
||||
->from('USD')
|
||||
->to($convert_name)
|
||||
->amount($usdPrice)
|
||||
->get();
|
||||
|
||||
return response()->json([
|
||||
'usd_price' => $usdPrice,
|
||||
'selected_week' => $convert_to,
|
||||
'converted_amount' => $converted,
|
||||
'start_date' => $start_date,
|
||||
'end_date' => $end_date,
|
||||
]);
|
||||
}
|
||||
|
||||
public function insert_volunteer_program_detail(Request $request) {
|
||||
dd($request->all());
|
||||
if (Auth::check()) {
|
||||
$userId = Auth::user()->id;
|
||||
$iam_principal_group = new iam_principal_group;
|
||||
$iam_principal_group->programs_xid = $request->input('program_id');
|
||||
$iam_principal_group->week = $request->input('select_duration');
|
||||
$iam_principal_group->currency = $request->input('convert_to');
|
||||
$iam_principal_group->volunteer_with = $request->input('volunteer');
|
||||
$iam_principal_group->volunteer_group_count = $request->input('member');
|
||||
$iam_principal_group->volunteer_group_name = $request->input('group_name');
|
||||
$iam_principal_group->group_member_name = json_encode($request->input('group_member_name'));
|
||||
$iam_principal_group->group_member_email = json_encode($request->input('group_member_email'));
|
||||
$iam_principal_group->save();
|
||||
$iam_principal_group_link = new iam_principal_principal_group_link;
|
||||
$iam_principal_group_link->principal_xid = $userId;
|
||||
$iam_principal_group_link->principal_group_xid = $iam_principal_group->id;
|
||||
$iam_principal_group_link->save();
|
||||
return response()->json(['success' => true, 'status' => 200]);
|
||||
} else {
|
||||
// The user is not logged in or authenticated
|
||||
$userId = null;
|
||||
return response()->json(['error' => 'Please register to continue using our services.'], 401);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
20
app/Http/Middleware/CustomMiddleware.php
Normal file
20
app/Http/Middleware/CustomMiddleware.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class CustomMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
17
app/Http/Middleware/EncryptCookies.php
Normal file
17
app/Http/Middleware/EncryptCookies.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
30
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
30
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, string ...$guards): Response
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
19
app/Http/Middleware/TrimStrings.php
Normal file
19
app/Http/Middleware/TrimStrings.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
||||
20
app/Http/Middleware/TrustHosts.php
Normal file
20
app/Http/Middleware/TrustHosts.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array<int, string|null>
|
||||
*/
|
||||
public function hosts(): array
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
||||
28
app/Http/Middleware/TrustProxies.php
Normal file
28
app/Http/Middleware/TrustProxies.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array<int, string>|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
Request::HEADER_X_FORWARDED_PORT |
|
||||
Request::HEADER_X_FORWARDED_PROTO |
|
||||
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||
}
|
||||
22
app/Http/Middleware/ValidateSignature.php
Normal file
22
app/Http/Middleware/ValidateSignature.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
|
||||
|
||||
class ValidateSignature extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the query string parameters that should be ignored.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
// 'fbclid',
|
||||
// 'utm_campaign',
|
||||
// 'utm_content',
|
||||
// 'utm_medium',
|
||||
// 'utm_source',
|
||||
// 'utm_term',
|
||||
];
|
||||
}
|
||||
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
30
app/Http/Middleware/WebsiteMiddleware.php
Normal file
30
app/Http/Middleware/WebsiteMiddleware.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class WebsiteMiddleware {
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response {
|
||||
|
||||
$user = Auth::check();
|
||||
// dd($user);
|
||||
|
||||
if ($user) {
|
||||
return $next($request);
|
||||
} else {
|
||||
return redirect('/website_login')->with('error_msg', 'You must be logged in..');
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
29
app/Http/Middleware/admin_auth_check.php
Normal file
29
app/Http/Middleware/admin_auth_check.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class admin_auth_check {
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next) {
|
||||
$admin = auth()->guard('admin')->user(); // Retrieve the authenticated admin user
|
||||
|
||||
if ($admin && $admin->status == 1) {
|
||||
return $next($request);
|
||||
} else {
|
||||
return redirect('/admin_sign_in')->with('error_msg','You must be logged in..');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
53
app/Mail/AdminNotificationEmail.php
Normal file
53
app/Mail/AdminNotificationEmail.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class AdminNotificationEmail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Admin Notification Email',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(
|
||||
view: 'view.name',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
70
app/Mail/Backend/AdminContactUsMail.php
Normal file
70
app/Mail/Backend/AdminContactUsMail.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail\Backend;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\Admin\mail_template;
|
||||
use View;
|
||||
|
||||
class AdminContactUsMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $mailData;
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($mailData)
|
||||
{
|
||||
$this->mailData = $mailData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
// public function envelope(): Envelope
|
||||
// {
|
||||
// return new Envelope(
|
||||
// subject: 'Admin Contact Us Mail',
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
// public function content(): Content
|
||||
// {
|
||||
// return new Content(
|
||||
// view: 'Admin.Templates.admin_contact_us',
|
||||
// );
|
||||
// }
|
||||
|
||||
public function build()
|
||||
{
|
||||
$mailDescription = mail_template::find(3);
|
||||
$predefinedValues = ['{{$name}}','{{$title}}','{{$body}}','{{$email}}'];
|
||||
$newValues = [$this->mailData['name'],$this->mailData['title'],$this->mailData['body'],$this->mailData['email']];
|
||||
$mailData = str_replace($predefinedValues,$newValues,$mailDescription->description);
|
||||
// $data = $this->mailData;
|
||||
// dd($data);
|
||||
return $this->subject('Mail from Lean In World')
|
||||
->view('Admin.Templates.admin_contact_us',["content"=>$mailData]);
|
||||
// ->view('Admin.Templates.admin_contact_us')
|
||||
// ->with(['data' => $data]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
68
app/Mail/Backend/AdminOtp.php
Normal file
68
app/Mail/Backend/AdminOtp.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail\Backend;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\Admin\mail_template;
|
||||
use View;
|
||||
|
||||
class AdminOtp extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $mailData;
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($mailData)
|
||||
{
|
||||
$this->mailData = $mailData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
// public function envelope(): Envelope
|
||||
// {
|
||||
// return new Envelope(
|
||||
// subject: 'Admin Otp',
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
// public function content(): Content
|
||||
// {
|
||||
// return new Content(
|
||||
// view: 'view.name',
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
|
||||
public function build()
|
||||
{
|
||||
|
||||
$mailDescription = mail_template::first();
|
||||
$predefinedValues = ['{{$name}}','{{$otp}}'];
|
||||
$newValues = [$this->mailData['name'],$this->mailData['otp']];
|
||||
$mailData = str_replace($predefinedValues,$newValues,$mailDescription->description);
|
||||
|
||||
return $this->subject('Mail from Lean In World')
|
||||
->view('Admin.Templates.adminotp',["content"=>$mailData]);
|
||||
}
|
||||
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
65
app/Mail/Backend/DocumentRequest.php
Normal file
65
app/Mail/Backend/DocumentRequest.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail\Backend;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\Admin\mail_template;
|
||||
use View;
|
||||
|
||||
class DocumentRequest extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
// public function envelope(): Envelope
|
||||
// {
|
||||
// return new Envelope(
|
||||
// subject: 'Document Request',
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
// public function content(): Content
|
||||
// {
|
||||
// return new Content(
|
||||
// view: 'view.name',
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
|
||||
public function build()
|
||||
{
|
||||
$mailDescription = mail_template::find(4);
|
||||
$mailData = $mailDescription->description;
|
||||
return $this->subject('Mail from Lean In World')
|
||||
->view('Admin.Templates.document_request',["content"=>$mailData]);
|
||||
}
|
||||
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
53
app/Mail/DocumentRequest.php
Normal file
53
app/Mail/DocumentRequest.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class DocumentRequest extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Document Request',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(
|
||||
view: 'view.name',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
73
app/Mail/Frontend/AdminNotificationEmail.php
Normal file
73
app/Mail/Frontend/AdminNotificationEmail.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail\Frontend;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\Admin\mail_template;
|
||||
use View;
|
||||
|
||||
|
||||
class AdminNotificationEmail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $contact;
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($contact)
|
||||
{
|
||||
$this->contact = $contact;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
// public function envelope(): Envelope
|
||||
// {
|
||||
// return new Envelope(
|
||||
// subject: 'Admin Notification Email',
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
// public function content(): Content
|
||||
// {
|
||||
// return new Content(
|
||||
// view: 'Frontend.Templates.contact_us_mailto_admin',
|
||||
// );
|
||||
// }
|
||||
|
||||
public function build()
|
||||
{
|
||||
$mailDescription = mail_template::find(7);
|
||||
$predefinedValues = ['{{$name}}','{{$email}}','{{$title}}','{{$message}}'];
|
||||
$newValues = [$this->contact['name'],$this->contact['email'],$this->contact['title'],$this->contact['message']];
|
||||
$mailData = str_replace($predefinedValues,$newValues,$mailDescription->description);
|
||||
|
||||
return $this->subject('Mail from Lean In World')
|
||||
->view('Frontend.Templates.contact_us_mailto_admin',["content"=>$mailData]);
|
||||
|
||||
|
||||
// $data = $this->contact;
|
||||
// return $this->subject('Mail from Remider')
|
||||
// ->view('Frontend.Templates.contact_us_mailto_admin')
|
||||
// ->with(['data' => $data]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
88
app/Mail/Frontend/ContactUsMail.php
Normal file
88
app/Mail/Frontend/ContactUsMail.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail\Frontend;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\Admin\mail_template;
|
||||
use View;
|
||||
|
||||
class ContactUsMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $contact;
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($contact)
|
||||
{
|
||||
$this->contact = $contact;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
// public function envelope(): Envelope
|
||||
// {
|
||||
// return new Envelope(
|
||||
// subject: 'Inquiry/Request for Contact Leaninworld.org',
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
// public function content(): Content
|
||||
// {
|
||||
// return new Content(
|
||||
// view: 'Frontend.Templates.contact_us',
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
// $data = $this->contact;
|
||||
// dd($data);
|
||||
// #attributes: array:7 [
|
||||
// "name" => "Megha Ganesh Malore"
|
||||
// "email" => "megha@wdimails.com"
|
||||
// "title" => "Enquirry"
|
||||
// "message" => "EnquirryEnquirryEnquirryEnquirryEnquirry"
|
||||
// "updated_at" => "2023-11-07 06:57:51"
|
||||
// "created_at" => "2023-11-07 06:57:51"
|
||||
// "id" => 61
|
||||
// ]
|
||||
|
||||
$mailDescription = mail_template::find(6);
|
||||
$predefinedValues = ['{{$name}}'];
|
||||
$newValues = [$this->contact['name']];
|
||||
$mailData = str_replace($predefinedValues,$newValues,$mailDescription->description);
|
||||
|
||||
return $this->subject('Mail from Lean In World')
|
||||
->view('Frontend.Templates.contact_us',["content"=>$mailData]);
|
||||
|
||||
// $data = $this->contact;
|
||||
// return $this->subject('Mail from Lean In World')
|
||||
// ->view('Frontend.Templates.contact_us')
|
||||
// ->with(['data' => $data]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
90
app/Mail/Frontend/GroupMemberEmail.php
Normal file
90
app/Mail/Frontend/GroupMemberEmail.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail\Frontend;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class GroupMemberEmail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $iam_principal_group;
|
||||
public $program;
|
||||
public $user_fname;
|
||||
public $user_lname;
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($iam_principal_group,$program,$user_fname,$user_lname)
|
||||
{
|
||||
$this->iam_principal_group = $iam_principal_group;
|
||||
$this->program = $program;
|
||||
$this->user_fname = $user_fname;
|
||||
$this->user_lname = $user_lname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
// public function envelope(): Envelope
|
||||
// {
|
||||
// return new Envelope(
|
||||
// subject: 'Group Member Email',
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
// public function content(): Content
|
||||
// {
|
||||
// return new Content(
|
||||
// view: 'view.name',
|
||||
// );
|
||||
// }
|
||||
|
||||
public function build()
|
||||
{
|
||||
// Access iam_principal_group and program directly
|
||||
$iam_principal_group = $this->iam_principal_group;
|
||||
$program = $this->program;
|
||||
$user_fname = $this->user_fname;
|
||||
$user_lname = $this->user_lname;
|
||||
|
||||
// dd($user_fname,$user_lname);
|
||||
$groupMemberNames = json_decode($iam_principal_group->group_member_name);
|
||||
$groupMemberEmails = json_decode($iam_principal_group->group_member_email);
|
||||
|
||||
// Loop through each group member
|
||||
foreach ($groupMemberEmails as $key => $email) {
|
||||
$data = [
|
||||
'group_member_name' => $groupMemberNames[$key],
|
||||
'group_member_email' => $email,
|
||||
'start_date' => $iam_principal_group->start_date,
|
||||
'program_title' => $program->program_title,
|
||||
'Duration' => $iam_principal_group->week,
|
||||
'first_name' => $this->user_fname,
|
||||
'last_name' => $this->user_lname
|
||||
];
|
||||
// dd($data);
|
||||
// Send an email to the current group member
|
||||
$this->subject('Program Invitation Mail')
|
||||
->to($email)
|
||||
->view('Frontend.Templates.group_member_invitation', ["content" => $data]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
74
app/Mail/Frontend/NewsLetterMail.php
Normal file
74
app/Mail/Frontend/NewsLetterMail.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail\Frontend;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\Admin\mail_template;
|
||||
use View;
|
||||
|
||||
class NewsLetterMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $program;
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($program)
|
||||
{
|
||||
$this->program = $program;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
// public function envelope(): Envelope
|
||||
// {
|
||||
// return new Envelope(
|
||||
// subject: 'News Letter Mail',
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
// public function content(): Content
|
||||
// {
|
||||
// return new Content(
|
||||
// view: 'view.name',
|
||||
// );
|
||||
// }
|
||||
|
||||
public function build()
|
||||
{
|
||||
$mailDescription = mail_template::find(8);
|
||||
$predefinedValues = ['{{$program_title}}','{{$start_date}}'];
|
||||
$newValues = [$this->program['program_title'],$this->program['start_date']];
|
||||
$mailData = str_replace($predefinedValues,$newValues,$mailDescription->description);
|
||||
|
||||
return $this->subject('Launch of New Program')
|
||||
->view('Frontend.Templates.newsletter',["content"=>$mailData]);
|
||||
|
||||
|
||||
|
||||
|
||||
// $data = $this->user_data;
|
||||
// return $this->subject('Mail from Lean In World')
|
||||
// ->view('Frontend.Templates.register_user')
|
||||
// ->with(['data' => $data]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
70
app/Mail/Frontend/PasswordResetMail.php
Normal file
70
app/Mail/Frontend/PasswordResetMail.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail\Frontend;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\Admin\mail_template;
|
||||
use View;
|
||||
|
||||
|
||||
class PasswordResetMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
// public function envelope(): Envelope
|
||||
// {
|
||||
// return new Envelope(
|
||||
// subject: 'Password Reset Mail',
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
// public function content(): Content
|
||||
// {
|
||||
// return new Content(
|
||||
// view: 'view.name',
|
||||
// );
|
||||
// }
|
||||
|
||||
|
||||
public function build()
|
||||
{
|
||||
// dd($this->data['token']);
|
||||
$mailDescription = mail_template::find(9);
|
||||
$predefinedValues = ['{{$token}}'];
|
||||
$newValues = [$this->data['token']];
|
||||
$mailData = str_replace($predefinedValues,$newValues,$mailDescription->description);
|
||||
|
||||
return $this->subject('Mail from Lean In World')
|
||||
->view('Admin.Templates.adminotp',["content"=>$mailData]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
75
app/Mail/Frontend/RegisterationMail.php
Normal file
75
app/Mail/Frontend/RegisterationMail.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail\Frontend;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\Admin\mail_template;
|
||||
use View;
|
||||
|
||||
|
||||
class RegisterationMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
public $user_data;
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($user_data)
|
||||
{
|
||||
$this->user_data = $user_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
// public function envelope(): Envelope
|
||||
// {
|
||||
// return new Envelope(
|
||||
// subject: 'Registeration Mail',
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
// public function content(): Content
|
||||
// {
|
||||
// return new Content(
|
||||
// view: 'Frontend.Templates.register_user',
|
||||
// );
|
||||
// }
|
||||
|
||||
public function build()
|
||||
{
|
||||
$mailDescription = mail_template::find(5);
|
||||
$predefinedValues = ['{{$first_name}}','{{$last_name}}'];
|
||||
$newValues = [$this->user_data['first_name'],$this->user_data['last_name']];
|
||||
$mailData = str_replace($predefinedValues,$newValues,$mailDescription->description);
|
||||
|
||||
return $this->subject('Successful Registration - Welcome to [Event/Platform/Organization]')
|
||||
->view('Frontend.Templates.register_user',["content"=>$mailData]);
|
||||
|
||||
|
||||
|
||||
|
||||
// $data = $this->user_data;
|
||||
// return $this->subject('Mail from Lean In World')
|
||||
// ->view('Frontend.Templates.register_user')
|
||||
// ->with(['data' => $data]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
68
app/Mail/Frontend/sendCancellationEmail.php
Normal file
68
app/Mail/Frontend/sendCancellationEmail.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail\Frontend;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Models\Admin\mail_template;
|
||||
use View;
|
||||
|
||||
class sendCancellationEmail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $user_data;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($user_data)
|
||||
{
|
||||
$this->user_data = $user_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
// public function envelope(): Envelope
|
||||
// {
|
||||
// return new Envelope(
|
||||
// subject: 'Send Cancellation Email',
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
// public function content(): Content
|
||||
// {
|
||||
// return new Content(
|
||||
// view: 'view.name',
|
||||
// );
|
||||
// }
|
||||
|
||||
public function build()
|
||||
{
|
||||
$mailDescription = mail_template::find(10);
|
||||
$predefinedValues = ['{{$first_name}}','{{$last_name}}'];
|
||||
$newValues = [$this->user_data['first_name'],$this->user_data['last_name']];
|
||||
$mailData = str_replace($predefinedValues,$newValues,$mailDescription->description);
|
||||
return $this->subject('Lean In Program Fee Deadline!')
|
||||
->view('Frontend.Templates.send_regi_failed',["content"=>$mailData]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
53
app/Mail/WelcomeEmail.php
Normal file
53
app/Mail/WelcomeEmail.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class WelcomeEmail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
return new Envelope(
|
||||
subject: 'Welcome Email',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
return new Content(
|
||||
view: 'view.name',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
11
app/Models/Admin/ProgramCurrencyAmount.php
Normal file
11
app/Models/Admin/ProgramCurrencyAmount.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProgramCurrencyAmount extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
11
app/Models/Admin/ProgramImage.php
Normal file
11
app/Models/Admin/ProgramImage.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProgramImage extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
19
app/Models/Admin/Testimonial.php
Normal file
19
app/Models/Admin/Testimonial.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Admin\country;
|
||||
|
||||
class Testimonial extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo(country::class,'country_xid');
|
||||
}
|
||||
}
|
||||
19
app/Models/Admin/blog.php
Normal file
19
app/Models/Admin/blog.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Admin\blog_category;
|
||||
|
||||
class blog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
|
||||
public function categ()
|
||||
{
|
||||
return $this->belongsTo(blog_category::class,'id');
|
||||
}
|
||||
}
|
||||
21
app/Models/Admin/blog_category.php
Normal file
21
app/Models/Admin/blog_category.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Admin\blog;
|
||||
|
||||
|
||||
class blog_category extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
|
||||
public function blog()
|
||||
{
|
||||
return $this->hasMany(blog::class,'blog_categories_xid');
|
||||
}
|
||||
|
||||
}
|
||||
18
app/Models/Admin/city.php
Normal file
18
app/Models/Admin/city.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Admin\state;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class city extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
|
||||
public function get_state(){
|
||||
return $this->hasOne(state::class,'id','states_xid');
|
||||
}
|
||||
}
|
||||
11
app/Models/Admin/contact_us_details.php
Normal file
11
app/Models/Admin/contact_us_details.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class contact_us_details extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
28
app/Models/Admin/country.php
Normal file
28
app/Models/Admin/country.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Admin\country;
|
||||
use App\Models\Admin\state;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Admin\program;
|
||||
|
||||
class country extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
|
||||
public function program()
|
||||
{
|
||||
return $this->belongsTo(Program::class, 'country_xid', 'id');
|
||||
}
|
||||
|
||||
public function programs()
|
||||
{
|
||||
return $this->hasMany(Program::class,'country_xid', 'id');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
15
app/Models/Admin/faq.php
Normal file
15
app/Models/Admin/faq.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
||||
class faq extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
|
||||
}
|
||||
15
app/Models/Admin/faq_category.php
Normal file
15
app/Models/Admin/faq_category.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
||||
class faq_category extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
|
||||
}
|
||||
11
app/Models/Admin/latest_update.php
Normal file
11
app/Models/Admin/latest_update.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class latest_update extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
11
app/Models/Admin/mail_template.php
Normal file
11
app/Models/Admin/mail_template.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class mail_template extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
52
app/Models/Admin/manage_admin.php
Normal file
52
app/Models/Admin/manage_admin.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use App\Models\Admin\manage_admin;
|
||||
use App\Models\Admin\manage_module;
|
||||
use App\Models\Admin\manage_admin_manage_module_link;
|
||||
|
||||
class manage_admin extends Authenticatable
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
protected $table = 'manage_admins';
|
||||
|
||||
protected $fillable = ['last_login'];
|
||||
|
||||
public function getPermissionGranted($id,$module){
|
||||
// $id is used as authuser id
|
||||
// $moudle is the slug of sidebar module
|
||||
|
||||
$isSubAdmin = manage_admin::where('id',$id)->where('is_admin',1)->first();
|
||||
// 'is_admin',1 is for checking the login user is subadmin or not
|
||||
|
||||
$isMainAdmin = manage_admin::where('id',$id)->where('is_admin',0)->first();
|
||||
if($isMainAdmin){
|
||||
return true;
|
||||
}elseif($isSubAdmin){
|
||||
//search for module
|
||||
$isModule = manage_module::where('slug',$module)->first();
|
||||
if($isModule){
|
||||
|
||||
$isSubAdminModuleLink = manage_admin_manage_module_link::where('sub_admin_xid',$id)
|
||||
->where('manage_modules_xid',$isModule->id)->first();
|
||||
// dd($id,$module,$isSubAdmin->id,$isModule,$isSubAdminModuleLink);
|
||||
if($isSubAdminModuleLink){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
16
app/Models/Admin/manage_admin_manage_module_link.php
Normal file
16
app/Models/Admin/manage_admin_manage_module_link.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Admin\manage_module;
|
||||
|
||||
class manage_admin_manage_module_link extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public function modules_sub_admin() {
|
||||
return $this->hasOne(manage_module::class, 'sub_admin_xid', 'id');
|
||||
}
|
||||
}
|
||||
16
app/Models/Admin/manage_module.php
Normal file
16
app/Models/Admin/manage_module.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Admin\manage_admin_manage_module_link;
|
||||
|
||||
class manage_module extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public function modules() {
|
||||
return $this->hasMany(manage_admin_manage_module_link::class, 'manage_modules_xid', 'id');
|
||||
}
|
||||
}
|
||||
13
app/Models/Admin/message_board.php
Normal file
13
app/Models/Admin/message_board.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class message_board extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
}
|
||||
13
app/Models/Admin/privacy_policy.php
Normal file
13
app/Models/Admin/privacy_policy.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class privacy_policy extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
}
|
||||
44
app/Models/Admin/program.php
Normal file
44
app/Models/Admin/program.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use App\Models\Admin\ProgramImage;
|
||||
use App\Models\Admin\ProgramCurrencyAmount;
|
||||
use App\Models\Admin\message_board;
|
||||
use App\Models\Admin\country;
|
||||
use App\Models\Admin\program_accomadation;
|
||||
|
||||
|
||||
class program extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
|
||||
public function programe_images()
|
||||
{
|
||||
return $this->hasMany(ProgramImage::class,'programs_xid');
|
||||
}
|
||||
|
||||
public function programe_amount()
|
||||
{
|
||||
return $this->hasMany(ProgramCurrencyAmount::class,'programs_xid');
|
||||
}
|
||||
|
||||
public function programe_country()
|
||||
{
|
||||
return $this->hasMany(country::class, 'id', 'country_xid');
|
||||
}
|
||||
|
||||
public function programe_acomadation()
|
||||
{
|
||||
return $this->hasMany(program_accomadation::class,'programs_xid');
|
||||
}
|
||||
|
||||
public function programe_message_board()
|
||||
{
|
||||
return $this->hasMany(message_board::class,'programs_xid');
|
||||
}
|
||||
}
|
||||
11
app/Models/Admin/program_accomadation.php
Normal file
11
app/Models/Admin/program_accomadation.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class program_accomadation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
16
app/Models/Admin/state.php
Normal file
16
app/Models/Admin/state.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Admin\country;
|
||||
|
||||
class state extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public function get_country(){
|
||||
return $this->hasOne(country::class,'id','country_xid');
|
||||
}
|
||||
}
|
||||
13
app/Models/Frontend/ContactUs.php
Normal file
13
app/Models/Frontend/ContactUs.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Frontend;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ContactUs extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
}
|
||||
71
app/Models/Frontend/User.php
Normal file
71
app/Models/Frontend/User.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Frontend;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Admin\country;
|
||||
use App\Models\Admin\program;
|
||||
use App\Models\Frontend\volunteer_profile_document;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use App\Models\Frontend\payment_transaction_master;
|
||||
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasFactory;
|
||||
protected $table = 'iam_principal';
|
||||
|
||||
public function paymentTransactions()
|
||||
{
|
||||
return $this->hasMany(payment_transaction_master::class,'principal_xid');
|
||||
}
|
||||
|
||||
public function user_documents()
|
||||
{
|
||||
return $this->hasMany(volunteer_profile_document::class,'principal_xid');
|
||||
}
|
||||
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo(country::class,'id');
|
||||
}
|
||||
|
||||
public function get_single_country()
|
||||
{
|
||||
return $this->hasOne(country::class,'id');
|
||||
}
|
||||
|
||||
public function get_sngle_program()
|
||||
{
|
||||
return $this->hasOne(program::class,'id');
|
||||
}
|
||||
|
||||
protected $guarded = ['id',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'email',
|
||||
'email_verified_at',
|
||||
'password',
|
||||
'programs_xid',
|
||||
'country_xid',
|
||||
'start_date',
|
||||
'duration',
|
||||
'phone_number',
|
||||
'gender',
|
||||
'date_of_birth',
|
||||
'address_line1',
|
||||
'city',
|
||||
'country',
|
||||
'state',
|
||||
'post_code',
|
||||
'lang_level',
|
||||
'hear_about_us',
|
||||
'motivation_to_join_program',
|
||||
'any_comment',
|
||||
'created_at',
|
||||
'updated_at'];
|
||||
|
||||
|
||||
|
||||
}
|
||||
11
app/Models/Frontend/iam_principal_group.php
Normal file
11
app/Models/Frontend/iam_principal_group.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Frontend;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class iam_principal_group extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
11
app/Models/Frontend/iam_principal_principal_group_link.php
Normal file
11
app/Models/Frontend/iam_principal_principal_group_link.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Frontend;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class iam_principal_principal_group_link extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
17
app/Models/Frontend/news_letter.php
Normal file
17
app/Models/Frontend/news_letter.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Frontend;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class news_letter extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table="news_letters";
|
||||
|
||||
protected $fillable=['first_name','email'];
|
||||
}
|
||||
27
app/Models/Frontend/payment_transaction_master.php
Normal file
27
app/Models/Frontend/payment_transaction_master.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Frontend;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Frontend\User;
|
||||
use App\Models\Admin\program;
|
||||
use App\Models\Admin\program_accomadation;
|
||||
|
||||
class payment_transaction_master extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public function Programs()
|
||||
{
|
||||
return $this->belongsTo(program::class, 'programs_xid');
|
||||
}
|
||||
// for fetch user_name in table
|
||||
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'principal_xid');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
17
app/Models/Frontend/user_rating.php
Normal file
17
app/Models/Frontend/user_rating.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Frontend;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Frontend\User;
|
||||
|
||||
class user_rating extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'principal_xid', 'id');
|
||||
}
|
||||
}
|
||||
17
app/Models/Frontend/volunteer_profile_document.php
Normal file
17
app/Models/Frontend/volunteer_profile_document.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Frontend;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\Frontend\User;
|
||||
|
||||
class volunteer_profile_document extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
// public function user_documents()
|
||||
// {
|
||||
// return $this->hasOne(User::class,'id');
|
||||
// }
|
||||
}
|
||||
101
app/Models/User.php
Normal file
101
app/Models/User.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use App\Models\Admin\manage_admin;
|
||||
use App\Models\Admin\manage_module;
|
||||
use App\Models\Admin\manage_admin_manage_module_link;
|
||||
|
||||
class User extends Authenticatable {
|
||||
|
||||
use HasApiTokens,
|
||||
HasFactory,
|
||||
Notifiable;
|
||||
|
||||
protected $table = 'iam_principal';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'id',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'email',
|
||||
'email_verified_at',
|
||||
'password',
|
||||
'programs_xid',
|
||||
'country_xid',
|
||||
'start_date',
|
||||
'duration',
|
||||
'phone_number',
|
||||
'gender',
|
||||
'date_of_birth',
|
||||
'address_line1',
|
||||
'city',
|
||||
'country',
|
||||
'state',
|
||||
'post_code',
|
||||
'lang_level',
|
||||
'hear_about_us',
|
||||
'motivation_to_join_program',
|
||||
'any_comment',
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
];
|
||||
|
||||
|
||||
public function getPermissionGranted($id,$module){
|
||||
// $id is used as authuser id
|
||||
// $moudle is the slug of sidebar module
|
||||
|
||||
$isSubAdmin = manage_admin::where('id',$id)->where('is_admin',1)->first();
|
||||
// 'is_admin',1 is for checking the login user is subadmin or not
|
||||
|
||||
if($isSubAdmin){
|
||||
//search for module
|
||||
$isModule = manage_module::where('slug',$module)->first();
|
||||
if($isModule){
|
||||
$isSubAdminModuleLink = manage_admin_manage_module_link::where('sub_admin_xid',$id)
|
||||
->where('manage_modules_xid',$isModule->id)->first();
|
||||
if($isSubAdminModuleLink){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
29
app/Providers/AppServiceProvider.php
Normal file
29
app/Providers/AppServiceProvider.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use App\Models\Admin\latest_update;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
// Fetch the latest update data
|
||||
$show_update = latest_update::all()->toArray();
|
||||
|
||||
// Share the $update variable with all views
|
||||
view()->share('update', $show_update);
|
||||
}
|
||||
}
|
||||
26
app/Providers/AuthServiceProvider.php
Normal file
26
app/Providers/AuthServiceProvider.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
// use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The model to policy mappings for the application.
|
||||
*
|
||||
* @var array<class-string, class-string>
|
||||
*/
|
||||
protected $policies = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user