All Projects → faustbrian → laravel-leaderboard

faustbrian / laravel-leaderboard

Licence: MPL-2.0 License
No description or website provided.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to laravel-leaderboard

DNS-Sinkhole-Lists-A2
A DNS Sinkhole List for testing purposes. (not for use in production systems) - UUID: 0f90ca2c-4b0a-4fbe-b659-449ab30c4284
Stars: ✭ 19 (-51.28%)
Mutual labels:  whitelist, blacklist
accomplist
ACCOMPLIST - List Compiler
Stars: ✭ 51 (+30.77%)
Mutual labels:  whitelist, blacklist
Blocker Database
A global domain based database for NoScript, uBlock, uMatrix & ScriptSafe
Stars: ✭ 127 (+225.64%)
Mutual labels:  whitelist, blacklist
Spotify Adblock Linux
Spotify adblocker for Linux
Stars: ✭ 641 (+1543.59%)
Mutual labels:  whitelist, blacklist
CyberSecurity-Box
Firewall-System based on OpenWRT or Pi-Hole with UnBound, TOR, optional Privoxy, opt. ntopng and opt. Configuration of the AVM FRITZ!Box with Presets for Security and Port-List. Please visit:
Stars: ✭ 20 (-48.72%)
Mutual labels:  whitelist, blacklist
Usbguard
USBGuard is a software framework for implementing USB device authorization policies (what kind of USB devices are authorized) as well as method of use policies (how a USB device may interact with the system)
Stars: ✭ 668 (+1612.82%)
Mutual labels:  whitelist, blacklist
domainos
A laravel package for blacklisting or whitelisting specific email providers or domains
Stars: ✭ 22 (-43.59%)
Mutual labels:  whitelist, blacklist
Blackwhite
Domain, CIDR, IP black/white list, PAC generator
Stars: ✭ 251 (+543.59%)
Mutual labels:  whitelist, blacklist
magento-2-security
Magento 2 Security extension FREE. Security extension gives store owners the ability to detect the IP addresses that are intentionally attacking their store at any given time. Therefore, they have timely measures to prevent this issue such as blocking those IP addresses or sending warning emails to store owners.
Stars: ✭ 40 (+2.56%)
Mutual labels:  whitelist, blacklist
AntiBot
Lightweight BungeeCord plugin that aims to stop attacks on your server quickly and efficiently.
Stars: ✭ 42 (+7.69%)
Mutual labels:  whitelist, blacklist
Laravel Firewall
Web Application Firewall (WAF) package for Laravel
Stars: ✭ 544 (+1294.87%)
Mutual labels:  whitelist, blacklist
black-mirror
Automatically maintained malicious host blacklists and false-positive whitelists.
Stars: ✭ 41 (+5.13%)
Mutual labels:  whitelist, blacklist
Scriptsafe
a browser extension to bring security and privacy to chrome, firefox, and opera
Stars: ✭ 434 (+1012.82%)
Mutual labels:  whitelist, blacklist
Koa Ip
Ip filter middleware for koa, support whitelist and blacklist.
Stars: ✭ 37 (-5.13%)
Mutual labels:  whitelist, blacklist
Neodevhost
The Powerful Friendly Uptodate AD Blocking Hosts 最新强大而友善的去广告
Stars: ✭ 336 (+761.54%)
Mutual labels:  whitelist, blacklist
jsCast
📻 An Audio Streaming Application written in JavaScript
Stars: ✭ 23 (-41.03%)
Mutual labels:  whitelist, blacklist
unbound-dns-firewall
DNS-Firewall Python script for UNBOUND
Stars: ✭ 23 (-41.03%)
Mutual labels:  whitelist, blacklist
retrie
Efficient Trie-based regex unions for blacklist/whitelist filtering and one-pass mapping-based string replacing
Stars: ✭ 35 (-10.26%)
Mutual labels:  whitelist, blacklist
curse
Use this blacklist on your softwares and apps
Stars: ✭ 24 (-38.46%)
Mutual labels:  blacklist
mute-sites-by-default
WebExtension that mutes all sites by default and remembers unmuted sites
Stars: ✭ 19 (-51.28%)
Mutual labels:  whitelist

Laravel Leadboard

Build Status PHP from Packagist Latest Version License

This package offers to reward entities with points and to create a ranking based on these points.

It is possible to reward, penalize, multiply, redeem and reset points and entities can be blacklisted/whitelisted which makes it possible to prevent certain entities to receive points.

Each entity will receive a rank based on its points which could be used to display a listing of the users with the most points or something like that.

Installation

Require this package, with Composer, in the root directory of your project.

$ composer require artisanry/leaderboard

At last you need to publish the migration and run the migration:

php artisan vendor:publish --provider="Artisanry\Leaderboard\LeaderboardServiceProvider" && php artisan migrate

Usage

Trait

<?php

namespace App;

use Artisanry\Leaderboard\Traits\Boardable;

class User
{
    use Boardable;
}

Example

$user = App\User::find(1);

$events = [
    'CompletedProfile'      => 10,
    'SocialLoginFacebook'   => 5,
    'SocialLoginTwitter'    => 5,
    'SocialLoginGoogleplus' => 5,
];

// User filled out address, phone, email, etc.
if($user->completedProfile()) {
    $user->reward($events['CompletedProfile']);
}

// User added his Facebook profile
if($user->hasSocialProfile('facebook')) {
    $user->reward($events['SocialLoginFacebook']);
}

// User removed his Facebook profile
if($user->removedSocialProfile('facebook')) {
    $user->penalize($events['SocialLoginFacebook']);
}

// User purchased a premium package
$plan = App\Plan::findByTitle('Premium');

if($user->purchased($plan)) {
    $user->reward($plan->points);
}

// User wants to purchase something
$product = App\Product::find(1);

try {
    if($user->redeem($product->price)) {
        event(new ProductWasPurchased($product, $user));
    }
} catch(\Artisanry\Leaderboard\Exceptions\InsufficientFundsException $e) {
    // Not enough points
    dd($e);
}

Functions

Reward the given amount of points.

$user->reward(10);

Remove the given amount of points.

$user->penalize(5);

Multiply all points by the given factor.

$user->multiply(2);

Redeem the given amount of points.

$user->redeem(15);

Reset all points to zero.

$user->reset();

Blacklist the user. This will disable all functions except for blacklist/whitelist.

$user->blacklist();

Whitelist the user.

$user->whitelist();

Testing

$ phpunit

Security

If you discover a security vulnerability within this package, please send an e-mail to [email protected]. All security vulnerabilities will be promptly addressed.

Credits

This project exists thanks to all the people who contribute.

License

Mozilla Public License Version 2.0 (MPL-2.0).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].