| @@ 19-49 (lines=31) @@ | ||
| 16 | /** |
|
| 17 | * Class Karma100Achieve |
|
| 18 | */ |
|
| 19 | class Karma100Achieve extends AbstractAchieve |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * @var string |
|
| 23 | */ |
|
| 24 | public $title = 'Благодетель'; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @var string |
|
| 28 | */ |
|
| 29 | public $description = 'Набрать 100 кармы.'; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @var string |
|
| 33 | */ |
|
| 34 | public $image = '//karma.laravel.su/img/achievements/karma-100.gif'; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @throws \LogicException |
|
| 38 | */ |
|
| 39 | public function handle() |
|
| 40 | { |
|
| 41 | Karma::created(function (Karma $karma) { |
|
| 42 | $count = $karma->target->karma->count(); |
|
| 43 | ||
| 44 | if ($count === 100) { |
|
| 45 | $this->create($karma->target, $karma->created_at); |
|
| 46 | } |
|
| 47 | }); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 19-50 (lines=32) @@ | ||
| 16 | /** |
|
| 17 | * Class Karma10Achieve |
|
| 18 | */ |
|
| 19 | class Karma10Achieve extends AbstractAchieve |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * @var string |
|
| 23 | */ |
|
| 24 | public $title = 'Находчивый'; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @var string |
|
| 28 | */ |
|
| 29 | public $description = 'Набрать 10 кармы.'; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @var string |
|
| 33 | */ |
|
| 34 | public $image = '//karma.laravel.su/img/achievements/karma-10.gif'; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @throws \LogicException |
|
| 38 | */ |
|
| 39 | public function handle() |
|
| 40 | { |
|
| 41 | Karma::created(function (Karma $karma) { |
|
| 42 | ||
| 43 | $count = $karma->target->karma->count(); |
|
| 44 | ||
| 45 | if ($count === 10) { |
|
| 46 | $this->create($karma->target, $karma->created_at); |
|
| 47 | } |
|
| 48 | }); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| @@ 19-49 (lines=31) @@ | ||
| 16 | /** |
|
| 17 | * Class Karma500Achieve |
|
| 18 | */ |
|
| 19 | class Karma500Achieve extends AbstractAchieve |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * @var string |
|
| 23 | */ |
|
| 24 | public $title = 'Рэмбо'; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @var string |
|
| 28 | */ |
|
| 29 | public $description = 'Набрать 500 кармы.'; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @var string |
|
| 33 | */ |
|
| 34 | public $image = '//karma.laravel.su/img/achievements/karma-500.gif'; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @throws \LogicException |
|
| 38 | */ |
|
| 39 | public function handle() |
|
| 40 | { |
|
| 41 | Karma::created(function (Karma $karma) { |
|
| 42 | $count = $karma->target->karma->count(); |
|
| 43 | ||
| 44 | if ($count === 500) { |
|
| 45 | $this->create($karma->target, $karma->created_at); |
|
| 46 | } |
|
| 47 | }); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 19-49 (lines=31) @@ | ||
| 16 | /** |
|
| 17 | * Class Karma50Achieve |
|
| 18 | */ |
|
| 19 | class Karma50Achieve extends AbstractAchieve |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * @var string |
|
| 23 | */ |
|
| 24 | public $title = 'Любитель сладкого'; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @var string |
|
| 28 | */ |
|
| 29 | public $description = 'Набрать 50 кармы.'; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @var string |
|
| 33 | */ |
|
| 34 | public $image = '//karma.laravel.su/img/achievements/karma-50.gif'; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @throws \LogicException |
|
| 38 | */ |
|
| 39 | public function handle() |
|
| 40 | { |
|
| 41 | Karma::created(function (Karma $karma) { |
|
| 42 | $count = $karma->target->karma->count(); |
|
| 43 | ||
| 44 | if ($count === 50) { |
|
| 45 | $this->create($karma->target, $karma->created_at); |
|
| 46 | } |
|
| 47 | }); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 19-49 (lines=31) @@ | ||
| 16 | /** |
|
| 17 | * Class Thanks100Achieve |
|
| 18 | */ |
|
| 19 | class Thanks100Achieve extends AbstractAchieve |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * @var string |
|
| 23 | */ |
|
| 24 | public $title = 'Вопрошайка'; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @var string |
|
| 28 | */ |
|
| 29 | public $description = 'Получить 100 раз ответ на свои вопросы.'; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @var string |
|
| 33 | */ |
|
| 34 | public $image = '//karma.laravel.su/img/achievements/thanks-100.gif'; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @throws \LogicException |
|
| 38 | */ |
|
| 39 | public function handle() |
|
| 40 | { |
|
| 41 | Karma::created(function (Karma $karma) { |
|
| 42 | $count = $karma->user->thanks->count(); |
|
| 43 | ||
| 44 | if ($count === 100) { |
|
| 45 | $this->create($karma->user, $karma->created_at); |
|
| 46 | } |
|
| 47 | }); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 19-49 (lines=31) @@ | ||
| 16 | /** |
|
| 17 | * Class Thanks20Achieve |
|
| 18 | */ |
|
| 19 | class Thanks20Achieve extends AbstractAchieve |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * @var string |
|
| 23 | */ |
|
| 24 | public $title = 'Благодарный'; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @var string |
|
| 28 | */ |
|
| 29 | public $description = 'Высказать 20 благодарностей.'; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @var string |
|
| 33 | */ |
|
| 34 | public $image = '//karma.laravel.su/img/achievements/thanks-20.gif'; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @throws \LogicException |
|
| 38 | */ |
|
| 39 | public function handle() |
|
| 40 | { |
|
| 41 | Karma::created(function (Karma $karma) { |
|
| 42 | $count = $karma->user->thanks->count(); |
|
| 43 | ||
| 44 | if ($count === 20) { |
|
| 45 | $this->create($karma->user, $karma->created_at); |
|
| 46 | } |
|
| 47 | }); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 19-49 (lines=31) @@ | ||
| 16 | /** |
|
| 17 | * Class Thanks50Achieve |
|
| 18 | */ |
|
| 19 | class Thanks50Achieve extends AbstractAchieve |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * @var string |
|
| 23 | */ |
|
| 24 | public $title = 'Нахлебник'; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @var string |
|
| 28 | */ |
|
| 29 | public $description = 'Сказать 50 раз "спасибо".'; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @var string |
|
| 33 | */ |
|
| 34 | public $image = '//karma.laravel.su/img/achievements/thanks-50.gif'; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @throws \LogicException |
|
| 38 | */ |
|
| 39 | public function handle() |
|
| 40 | { |
|
| 41 | Karma::created(function (Karma $karma) { |
|
| 42 | $count = $karma->user->thanks->count(); |
|
| 43 | ||
| 44 | if ($count === 50) { |
|
| 45 | $this->create($karma->user, $karma->created_at); |
|
| 46 | } |
|
| 47 | }); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 19-49 (lines=31) @@ | ||
| 16 | /** |
|
| 17 | * Class Karma1000Achieve |
|
| 18 | */ |
|
| 19 | class Karma1000Achieve extends AbstractAchieve |
|
| 20 | { |
|
| 21 | /** |
|
| 22 | * @var string |
|
| 23 | */ |
|
| 24 | public $title = 'Jhaoda'; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @var string |
|
| 28 | */ |
|
| 29 | public $description = 'Больше кармы богу кармы!'; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @var string |
|
| 33 | */ |
|
| 34 | public $image = '//karma.laravel.su/img/achievements/karma-1000.gif'; |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @throws \LogicException |
|
| 38 | */ |
|
| 39 | public function handle() |
|
| 40 | { |
|
| 41 | Karma::created(function (Karma $karma) { |
|
| 42 | $count = $karma->target->karma->count(); |
|
| 43 | ||
| 44 | if ($count === 1000) { |
|
| 45 | $this->create($karma->target, $karma->created_at); |
|
| 46 | } |
|
| 47 | }); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||