public static function getCourier($key = null, $val = null) { if (is_null($key)) { $c = Courier::get(); self::$courier = $c; return new self(); } else { if ($key == '_id') { $val = new MongoId($val); } $c = Courier::where($key, '=', $val)->first(); self::$courier = $c; return $c; } }