public static function Create($owner) { if ( !Auth::Obj()->Authenticated() ) throw new Exception("Must be logged in"); $code = Invite::GenerateCode(); $data = array("code" => $code, "owner" => Auth::Obj()->User()->ID()); DB::zdb()->insert(Invite::$TABLE, $data); Log::Activity("generated invitation code " . $code); return new Invite($code); }