Skip to content

Instantly share code, notes, and snippets.

@imbue
imbue / specification.py
Created March 27, 2020 13:58
Specification
from abc import ABC, abstractmethod
class Specification(ABC):
@abstractmethod
def is_satisfied_by(self, candidate) -> bool:
raise NotImplementedError()
class CompositeSpecification(Specification, ABC):
@imbue
imbue / Order.php
Last active February 12, 2020 20:39
Model tenancy
<?php
namespace App\Models;
use Closure;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Builder;
class Order extends TenantableModel
{