Skip to content

Instantly share code, notes, and snippets.

View yesenvidnath's full-sized avatar
🎯
Focusing

Yesen Kandalama yesenvidnath

🎯
Focusing
View GitHub Profile
<?php
$servername = "localhost";
$username = "root";
$password = "1234"; // Optional for the users
$database = "geoffryx_db";
// Create connection
$conn = new mysqli($servername, $username, $password, $database);
// Check connection
/**
* Helper method to retrieve the authenticated user's ID.
*/
protected function getAuthenticatedUserId()
{
// Retrieve the authenticated user
$user = Auth::user();
// Check if the user is authenticated and return the user_ID
return $user ? $user->user_ID : null;
// Example : within this code we allow only the Admins to send bulk mesages
public function sendBulkNotification(Request $request)
{
// Get the authenticated user
$authenticatedUser = Auth::user();
// Check if the authenticated user is an admin
$isAdmin = DB::table('admins')
@yesenvidnath
yesenvidnath / Payment gateway Configuration
Last active October 13, 2024 23:11
Payhere PaymentGateway PhP Confguration
<!-- This is the index.php, I've added this coz stupid git is naming this Gist as index if i named the
first file as index.php, so now you know, Enjoye the coding guys : ) let me know if there are any errors -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Payment Page</title>