Skip to content

Instantly share code, notes, and snippets.

View eyupfidan's full-sized avatar
🎯
Focusing

Eyüp Fidan eyupfidan

🎯
Focusing
View GitHub Profile
@eyupfidan
eyupfidan / TelegramServices.php
Created September 19, 2024 11:32
Telegram Service For Laravel
<?php
namespace App\Services;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
class TelegramServices
{
protected Client $client;
@eyupfidan
eyupfidan / get-user-ip-address.php
Created September 19, 2024 07:20
This function retrieves the user's IP address by checking various server variables. It filters out private and reserved IP ranges to ensure only public IPs are returned. If no valid IP is found, it returns 'local'.
<?php
/**
* Get the user's IP address from various possible sources.
* It filters out private and reserved IP ranges.
* If no valid public IP is found, returns 'local'.
*
* @return string User's IP address or 'local' if not found.
*/
function getUserIpAddress() {
// Define the list of possible IP address sources
function showAlert(icon, title, text, url) {
Swal.fire({
icon: icon,
title: title,
text: text,
showDenyButton: false,
showCancelButton: true,
confirmButtonColor: "green",
confirmButtonText: "Onaylıyorum",
cancelButtonText: "Vazgeç",
@eyupfidan
eyupfidan / livesearch.js
Last active May 4, 2023 12:53
Live Search Jquery
// Refactored keyup event handler for the target link input
$(".target_link").on("keyup", function () {
const query = $(this).val();
if (query === "") {
$("#livesearch").html("No result found");
return;
}
$.ajax({
url: "../../action/project_article/live_search",
type: "GET",