Skip to content

Instantly share code, notes, and snippets.

View matejsvajger's full-sized avatar
🪲
shhh. be vewy vewy quiet i'm hunting cweepy-crawlies

Matej Svajger matejsvajger

🪲
shhh. be vewy vewy quiet i'm hunting cweepy-crawlies
View GitHub Profile
@emmanuelballery
emmanuelballery / .htaccess
Created October 24, 2017 07:15
Webpack compression GZ to Apache2 configuration
# requires (see apache2ctl -M) : sudo a2enmod mime expires rewrite headers
# mime
AddEncoding gzip .gz
# expires
ExpiresActive On
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType image/jpg "access plus 1 year"
@mpociot
mpociot / SingletonModel.php
Created January 24, 2020 13:59
Making it easier to work with single row models in Laravel
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SingletonModel extends Model
{
protected function store($data = [])
{
@thecrypticace
thecrypticace / ParentChildHierarchy.php
Last active February 20, 2020 07:09
Eloquent recursive relationships
<?php
namespace App;
use Illuminate\Database\Eloquent\Collection;
class ParentChildHierarchy
{
public static function apply($entities, $primaryKey = "id", $parentKey = "parent_id", $parentRelation = "parent", $childRelation = "children")
{