Skip to content

Instantly share code, notes, and snippets.

Working from home

William Mandai wmandai

Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am wmandai on github.
  • I am wmandai ( on keybase.
  • I have a public key ASAB1ir5HXMjIN3rypTZhK04H4XR1Aedjf5scfoVUew4jQo

To claim this, I am signing this object:

View Configurations for Laravel app on Kubernetes - Dockerfile
FROM php:7.2-fpm
COPY app /var/www/
View Controllers--Livewire--Chat.php
namespace App\Http\Livewire\Forum;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Livewire\WithPagination;
use Livewire\Component;
use App\Message;
use App\User;
class Chat extends Component
wmandai / 5ec3395c86134.php
Created Jun 23, 2021 — forked from owenconti/5ec3395c86134.php
Building a search drop down component with Laravel Livewire
View 5ec3395c86134.php
namespace App\Http\Livewire;
use App\Contact;
use Livewire\Component;
class ContactSearchBar extends Component
public $query;
wmandai / Download.php
Created Jun 23, 2021 — forked from nkeena/Download.php
Download a file using Laravel Livewire
View Download.php
use Livewire\Component;
class Download extends Component
public function download()
// get the path to the file
$path = "";
wmandai / AppServiceProvider.php
Created Jun 23, 2021 — forked from greenspace10/AppServiceProvider.php
Laravel, Livewire, Alpine JS Toast Notifications
View AppServiceProvider.php
* Bootstrap any application services.
* @return void
public function boot()
Component::macro('notify', function ($message, $title = '', $type = 'success') {
$this->dispatchBrowserEvent('notify', ['message' => $message, 'title' => $title, 'type' => $type]);
View enable AllowOverride for your DocumentRoot
Filename: /etc/apache2/sites-available/yoursite.conf
<VirtualHost *:80>
DocumentRoot "/var/www/"
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
wmandai / mpesa-paybill-inteception.php
Created Oct 3, 2016
Working with MPESA PAYBILL API (using Laravel)
View mpesa-paybill-inteception.php
// 1. First tell MPESA to enable the PAYBILL API
// 2. Give them the URL you want their servers to ping on a successful payment made
// 3. They will ping ur server’s with a URL like this if you gave them “"
// id=59538715& orig=MPESA& dest=254706513985& tstamp=2014-11-11+16%3A55%3A09& text=FY69MY145+Confirmed.+on+11%2F11%2F14+at+4%3A54+PM+Ksh4%2C516.00+received+from+MARGARET+WANJIRU+254714236724.+Account+Number+16042+New+Utility+balance+is+Ksh3 &customer_id=274& user=safaricom& pass=3EdoRm0XHiUPa7x4& routemethod_id=2& routemethod_name=HTTP& mpesa_code=FY69MY145& mpesa_acc=16042& mpesa_msisdn=254714236724& mpesa_trx_date=11%2F11%2F14& mpesa_trx_time=4%3A54+PM& mpesa_amt=4516.0& mpesa_sender=MARGARET+WANJIRU& business_number=8238238
// 4. Now just break apart the POST parameters, in laravel I’d do
View rewrite
server {
listen X.X.X.X:443 ssl http2;
ssl_protocols TLSv1.2;
ssl_certificate cert.pem;
ssl_certificate_key privkey.pem;
root /var/www/;
autoindex on;
index index.php;
location / {
wmandai / Codeigniter IIS web.config
Last active Jul 24, 2022
IIS web.config for codeigniter
View Codeigniter IIS web.config
<?xml version="1.0" encoding="UTF-8"?>
<rule name="Index">
<match url="^(.*)$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />