Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
#####
## Setup Swap
#####
if [ -f /swapfile ]; then
echo "Swap exists."
else
fallocate -l 1G /swapfile
chmod 600 /swapfile
@brianclogan
brianclogan / Contact.php
Last active April 16, 2019 22:33
Laravel Sort by Relationship Value
<?php
namespace App;
use App\Helpers\Formatting;
use Illuminate\Database\Eloquent\SoftDeletes;
use Propaganistas\LaravelPhone\PhoneNumber;
class Contact extends Model
{
@brianclogan
brianclogan / install.sh
Created February 3, 2018 04:16
Bungeecord Installation
#!/bin/bash
####
# Bungeecord Installer
####
# Install Requried Packages
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
@brianclogan
brianclogan / horizon-authorization-example.md
Created August 2, 2017 02:43
Laravel Horizon - Authorizing Access via IP Addresses on Production Environments

So, with Laravel Horizon here, I ventured to use it. I found something though, it is possible, but VERY difficult to get the current user in the App Service Provider.

I set out a different route, using IP Addresses.

Since our office has a static IP, I modified the following:

.env - Adding the remote addresses as a JSON encoded array to a new variable

REMOTE_ADDRESSES='["xxx.xxx.xxx.xxx"]'
@brianclogan
brianclogan / readme.md
Last active May 11, 2022 13:36
SENTRY WEBHOOK PUBLISH - FORGE

When using Laravel Forge with Sentry, I found that I wanted a way to, when Forge deployed a new update, alert sentry of a release.

Here is what I did.

Edit the deploy script and add:

VERSION='{"version":"'$(git log --pretty=format:'%H' -n 1)'"}'
curl {YOUR_SENTRY_URL_HERE}/ \
  -X POST \

-H 'Content-Type: application/json' \

[ -f git-log.txt ] && rm git-log.txt
git log -1 --pretty=%B > git-log.txt
if grep -Fq 'composer' git-log.txt; then
composer update --no-interaction
fi
php artisan migrate --force
php artisan cache:clear
[ -f git-log.txt ] && rm git-log.txt
git log -1 --pretty=%B > git-log.txt
if grep -Fq 'composer' git-log.txt; then
composer update --no-interaction
fi
php artisan migrate --force
php artisan cache:clear