This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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> |