Add the event listener for the awards #155

This commit is contained in:
Nabeel Shahzad
2018-03-17 00:55:39 -05:00
parent 31b9195a6e
commit 26f00ccaae
9 changed files with 127 additions and 53 deletions

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Awards;
use App\Interfaces\AwardInterface;
/**
* Simple example of an awards class, where you can apply an award when a user
* has 100 flights. All award classes need to implement the AwardInterface
* @package App\Awards
*/
class Pilot100Flights extends AwardInterface
{
public $name = 'Pilot 100 Flights';
/**
* If the user has over 100 flights, then we can give them this award
* @return bool
*/
public function check(): bool
{
return $this->user->flights >= 100;
}
}