Skip to content

Instantly share code, notes, and snippets.

View beisong7's full-sized avatar
๐Ÿš€
Bring me the sky...

Benjamin Isong beisong7

๐Ÿš€
Bring me the sky...
View GitHub Profile
@beisong7
beisong7 / organization.php
Last active May 14, 2020 01:58
Laravel Eloquent hasManyThrough
public function staffs(){
return $this->belongsToMany(
Staff::class,
OrganizationStaff::class,
'organization_id',
'staff_id',
'uuid',
'uuid'
);
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Windows.Forms;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
/// <summary>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class public_convert : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
@beisong7
beisong7 / Dockerfile
Last active April 13, 2021 14:22 — forked from shov/Dockerfile
Docker PHP 7.2 fpm with GD jpg, png suppot
FROM php:7.2-apache
RUN apt-get update
# WORKDIR /app
RUN apt-get install -y \
git \
zip \
curl \
@beisong7
beisong7 / controller.php
Last active June 25, 2020 12:49
Encryption with Laravel
<?php
\Illuminate\Encryption\Encrypter;
$key = 'password12345678';
$encrypter = new Encrypter($key);
$payload = ['username'=>'admin', 'password'=>'password'];
$encryption = $encrypter->encrypt($payload);
@beisong7
beisong7 / index.html
Created July 11, 2020 12:39
Handle Mixed Content blocked - when https tries to make http request
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The line below allows http requests to be upgraded to https.
if the request was initially served over https it will be safe
-->
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
@beisong7
beisong7 / APIController.php
Last active July 21, 2020 15:14
API to handle Funds Transfer Approach
<?php
namespace App\Http\Controllers;
use App\Services\ApiService;
use Illuminate\Http\Request;
@beisong7
beisong7 / laravel_query.php
Last active November 14, 2020 05:27
Basic Awesome Queries
Basic laravel Queries
- Hopefully OPtimised
@beisong7
beisong7 / simpleEncrypt.php
Last active February 5, 2021 21:46
Simple Encrypt and Decrypt
<?php
public function decrypt($payload, $password, $iv = null, $method=null){
if(empty($method)){
$method = "AES-128-CBC";
}
if(empty($iv)){
$iv = "";
@beisong7
beisong7 / create_payments_table.php
Last active February 24, 2021 09:44
Payment Schematics
<?php
Schema::create('payments', function (Blueprint $table) {
$table->bigIncrements('id');
$table->uuid('uuid')->unique();
$table->uuid('member_id')->nullable(); // the person paying uuid
$table->uuid('subscription_id')->nullable(); //if you have a subscription table else delete this line
$table->uuid('transaction_id')->nullable();
$table->float('amount', 10, 2)->nullable();
$table->string('reference_id')->nullable(); //paystack or flutter reference