Skip to content

Commit

Permalink
Update namespace Gstt -> Assada
Browse files Browse the repository at this point in the history
  • Loading branch information
assada committed Mar 4, 2020
1 parent 54ce7a2 commit 69a78fd
Show file tree
Hide file tree
Showing 27 changed files with 148 additions and 117 deletions.
1 change: 0 additions & 1 deletion .phpunit.result.cache

This file was deleted.

16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ An implementation of an Achievement System in Laravel, inspired by Laravel's Not
- Laravel 6 or higher
- PHP 7.2 or higher

## Versions and branches
- v1.* - Original `Gstt\*` namespace with supporting Laravel 6 and PHP7.2 (only fix and security updates)
- v2.* (master) - New namespace `Assada\*` with supporting Laravel 6 and PHP7.2 (fixes, security and feature updates)

## <a name="installation"></a> Installation

Default installation is via [Composer](https://getcomposer.org/).
Expand All @@ -42,7 +46,7 @@ The service provider will automatically get registered. Or you could add the Ser
```php
'providers' => [
...
Gstt\Achievements\AchievementsServiceProvider::class,
Assada\Achievements\AchievementsServiceProvider::class,
```

Backup your database and run the migrations in order to setup the required tables on the database.
Expand All @@ -68,7 +72,7 @@ what the Achievement is and how to unlock it. When you're done, it should look l

namespace App\Achievements;

use Gstt\Achievements\Achievement;
use Assada\Achievements\Achievement;

class UserMadeAPost extends Achievement
{
Expand All @@ -92,7 +96,7 @@ Achievements can be unlocked by using the `Achiever` trait.

namespace App;

use Gstt\Achievements\Achiever;
use Assada\Achievements\Achiever;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
Expand Down Expand Up @@ -123,7 +127,7 @@ In order to do that, you must set an additional parameter on your `UserMade10Pos

namespace App\Achievements;

use Gstt\Achievements\Achievement;
use Assada\Achievements\Achievement;

class UserMade10Posts extends Achievement
{
Expand Down Expand Up @@ -196,7 +200,7 @@ There are also three additional helpers on the `Achiever` trait: `lockedAchievem
### Listening to all Achievements
Laravel Achievements provides two events that can be listened to in order to provide "Achievement Unlocked" messages or similar. Both events receive the instance of `AchievementProgress` that triggered them.

The `Gstt\Achievements\Event\Progress` event triggers whenever an Achiever makes progress, but doesn't unlock an Achievement. The `Gstt\Achievements\Event\Unlocked` event triggers whenever an Achiever actually unlocks an achievement.
The `Assada\Achievements\Event\Progress` event triggers whenever an Achiever makes progress, but doesn't unlock an Achievement. The `Assada\Achievements\Event\Unlocked` event triggers whenever an Achiever actually unlocks an achievement.

Details on how to listen to those events are explained on [Laravel's Event documentation](https://laravel.com/docs/5.3/events).

Expand All @@ -209,7 +213,7 @@ The event listeners mentioned above triggers for all Achievements. If you would

namespace App\Achievements;

use Gstt\Achievements\Achievement;
use Assada\Achievements\Achievement;

class UserMade50Posts extends Achievement
{
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
"src/Migrations"
],
"psr-4": {
"Gstt\\Achievements\\": "src/",
"Gstt\\Tests\\": "tests/"
"Assada\\Achievements\\": "src/",
"Assada\\Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
"Gstt\\Achievements\\AchievementsServiceProvider"
"Assada\\Achievements\\AchievementsServiceProvider"
]
}
},
Expand Down
42 changes: 21 additions & 21 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</head>

<body>
<a href="https://github.com/gstt/laravel-achievements" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
<a href="https://github.com/assada/laravel-achievements" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
<div id="wrapper">

<div class="container">
Expand Down Expand Up @@ -187,7 +187,7 @@ <h4 id="line1_2">Installation</h4>
<p style="padding-bottom: 0;">1) Run the following <a href="https://getcomposer.org/" target="_blank">Composer</a>
command on the root of your Laravel application:
</p>
<pre>composer require gstt/laravel-achievements</pre>
<pre>composer require assada/laravel-achievements</pre>
<p style="padding-bottom: 0;">2) If you're using Laravel 5.3 or 5.4, add the Service
Provider to your <code>config/app.php</code> file, under the <code>providers</code>
section.<br />
Expand All @@ -196,12 +196,12 @@ <h4 id="line1_2">Installation</h4>
<pre class="brush: php;">
'providers' => [
...
Gstt\Achievements\AchievementsServiceProvider::class,
Assada\Achievements\AchievementsServiceProvider::class,
</pre>
<p style="padding-bottom: 0;">3) Run the artisan publish command in order to get the
migrations and config files set up in your system.
</p>
<pre>php artisan vendor:publish --provider="Gstt\Achievements\AchievementsServiceProvider"</pre>
<pre>php artisan vendor:publish --provider="Assada\Achievements\AchievementsServiceProvider"</pre>
<p style="padding-bottom: 0;">4) Backup your database and run the migrations in order
to install all tables required by Laravel Achievements.
</p>
Expand Down Expand Up @@ -248,7 +248,7 @@ <h4 id="line2_2">Registering an Achiever</h4>
<pre class="brush: php; highlight: [8]">
namespace App;

use Gstt\Achievements\Achiever;
use Assada\Achievements\Achiever;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
Expand Down Expand Up @@ -280,7 +280,7 @@ <h4 id="line2_3">Creating a new Achievement</h4>
<pre class="brush:php;">
namespace App\Achievements;

use Gstt\Achievements\Achievement;
use Assada\Achievements\Achievement;

class CreatedFirstComment extends Achievement
{
Expand Down Expand Up @@ -354,7 +354,7 @@ <h4 id="line2_5">Achievement Progression</h4>
<pre class="brush:php; highlight:[26]">
namespace App\Achievements;

use Gstt\Achievements\Achievement;
use Assada\Achievements\Achievement;

class CreatedTenComments extends Achievement
{
Expand Down Expand Up @@ -423,7 +423,7 @@ <h4 id="line2_5">Achievement Progression</h4>
<pre class="brush:php; highlight:[5]">
namespace App\Achievements;

use Gstt\Achievements\Achievement;
use Assada\Achievements\Achievement;

class CreatedCommentWith100Characters extends Achievement
{
Expand All @@ -436,7 +436,7 @@ <h4 id="line2_5">Achievement Progression</h4>
<pre class="brush:php; highlight:[5]">
namespace App\Achievements;

use Gstt\Achievements\Achievement;
use Assada\Achievements\Achievement;

class Commented1000Characters extends Achievement
{
Expand All @@ -449,7 +449,7 @@ <h4 id="line2_5">Achievement Progression</h4>
<pre class="brush:php; highlight:[5]">
namespace App\Achievements;

use Gstt\Achievements\Achievement;
use Assada\Achievements\Achievement;

class CreatedFiveConsecutiveCommentsWithOver100Characters extends Achievement
{
Expand Down Expand Up @@ -520,7 +520,7 @@ <h4 id="line2_6">Retrieving from DB</h4>
<code>unlockedAchievements()</code>.
</p>
<p>In order to retrieve all achievements, you can use the static method
<code>Gstt\Achievements\Achievement::all()</code>.</p>
<code>Assada\Achievements\Achievement::all()</code>.</p>

</section>
<!-- end section -->
Expand Down Expand Up @@ -566,7 +566,7 @@ <h4 id="line3_3">Handling a Chain</h4>
use App\Achievements\TenPosts;
use App\Achievements\FiftyPosts;

use Gstt\Achievements\AchievementChain;
use Assada\Achievements\AchievementChain;

class CommentChain extends AchievementChain
{
Expand Down Expand Up @@ -619,8 +619,8 @@ <h4 id="line4_1">Introduction</h4>
<hr>
<h4 id="line4_2">Available Events</h4>
<ul>
<li><code>Gstt\Achievements\Event\Progress</code>: Triggers whenever an Achiever has their progress points in an Achievement changed.</li>
<li><code>Gstt\Achievements\Event\Unlocked</code>: Triggers whenever an Achiever has unlocked an Achievement.</li>
<li><code>Assada\Achievements\Event\Progress</code>: Triggers whenever an Achiever has their progress points in an Achievement changed.</li>
<li><code>Assada\Achievements\Event\Unlocked</code>: Triggers whenever an Achiever has unlocked an Achievement.</li>
</ul>
<hr>
<h4 id="line4_3">Listening to Events</h4>
Expand All @@ -629,7 +629,7 @@ <h4 id="line4_3">Listening to Events</h4>
<h4 id="line4_4">Specific Achievement Events</h4>
<p>The event listeners mentioned above triggers for all Achievements. If you would like to add an event listener for only a specific Achievement, you can do so by implementing the methods <code>whenUnlocked()</code> or <code>whenProgress</code> on the Achievement class.</p>
<pre class="brush:php; highlight:[23,32]">
use Gstt\Achievements\Achievement;
use Assada\Achievements\Achievement;

class UserMade50Posts extends Achievement
{
Expand Down Expand Up @@ -703,11 +703,11 @@ <h4 id="line6_1">Introduction</h4>
<h4 id="line6_2">Achiever</h4>
<p style="padding-bottom: 0;">An <strong>Achiever</strong> is any Eloquent Model within your
system that is able to unlock and progress in Achievements. You can define that a Model is
an Achiever by including the <code>Gstt\Achievements\Achiever</code> trait to that model.</p>
an Achiever by including the <code>Assada\Achievements\Achiever</code> trait to that model.</p>
<pre class="brush: php; highlight: [8]">
namespace App;

use Gstt\Achievements\Achiever;
use Assada\Achievements\Achiever;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
Expand All @@ -720,7 +720,7 @@ <h4 id="line6_2">Achiever</h4>
<hr>
<h4 id="line6_3">Achievement</h4>
<p>An <strong>Achievement</strong> is a class that extends from the
<code>Gstt\Achievements\Achievement</code> class and describes what the Achievement is.
<code>Assada\Achievements\Achievement</code> class and describes what the Achievement is.
It's designed to be implemented in a similar way to the
<a href="https://laravel.com/docs/5.6/notifications" target="_blank">Laravel Notifications</a>
package - for every Achievement you use in your system, you will need to declare a class for it.
Expand All @@ -729,7 +729,7 @@ <h4 id="line6_3">Achievement</h4>
<pre class="brush: php;">
namespace App\Achievements;

use Gstt\Achievements\Achievement;
use Assada\Achievements\Achievement;

class UserMadeAPost extends Achievement
{
Expand Down Expand Up @@ -802,7 +802,7 @@ <h4 id="line6_5">AchievementProgress</h4>

<hr>
<h4 id="line6_6">Chain</h4>
<p>A <strong>Chain</strong> is a class that extends from <code>Gstt\Achievements\AchievementChain</code>
<p>A <strong>Chain</strong> is a class that extends from <code>Assada\Achievements\AchievementChain</code>
and defines a sequence of <code>Achievements</code> that are tracking the same thing.</p>
<p>A <strong>Chain</strong> looks like this:</p>
<pre class="brush: php;">
Expand All @@ -812,7 +812,7 @@ <h4 id="line6_6">Chain</h4>
use App\Achievements\TenPosts;
use App\Achievements\FiftyPosts;

use Gstt\Achievements\AchievementChain;
use Assada\Achievements\AchievementChain;

class PostChain extends AchievementChain
{
Expand Down
12 changes: 6 additions & 6 deletions src/Achievement.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
declare(strict_types=1);

namespace Gstt\Achievements;
namespace Assada\Achievements;

use Gstt\Achievements\Event\Progress as ProgressEvent;
use Gstt\Achievements\Event\Unlocked as UnlockedEvent;
use Gstt\Achievements\Model\AchievementDetails;
use Gstt\Achievements\Model\AchievementProgress;
use Assada\Achievements\Event\Progress as ProgressEvent;
use Assada\Achievements\Event\Unlocked as UnlockedEvent;
use Assada\Achievements\Model\AchievementDetails;
use Assada\Achievements\Model\AchievementProgress;
use Illuminate\Database\Eloquent\Model;

/**
* Class Achievement
*
* @package Gstt\Achievements
* @package Assada\Achievements
*/
abstract class Achievement implements CanAchieve
{
Expand Down
6 changes: 3 additions & 3 deletions src/AchievementChain.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
declare(strict_types=1);

namespace Gstt\Achievements;
namespace Assada\Achievements;

use Gstt\Achievements\Model\AchievementProgress;
use Assada\Achievements\Model\AchievementProgress;

/**
* Class AchievementChain
*
* @package Gstt\Achievements
* @package Assada\Achievements
*/
abstract class AchievementChain implements CanAchieve
{
Expand Down
10 changes: 5 additions & 5 deletions src/AchievementsServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php
declare(strict_types=1);

namespace Gstt\Achievements;
namespace Assada\Achievements;

use Gstt\Achievements\Console\AchievementChainMakeCommand;
use Gstt\Achievements\Console\AchievementMakeCommand;
use Assada\Achievements\Console\AchievementChainMakeCommand;
use Assada\Achievements\Console\AchievementMakeCommand;
use Illuminate\Support\ServiceProvider;

/**
* Class AchievementsServiceProvider
*
* @package Gstt\Achievements
* @package Assada\Achievements
*/
class AchievementsServiceProvider extends ServiceProvider
{
Expand All @@ -25,7 +25,7 @@ public function boot(): void
if ($this->app->runningInConsole()) {
$this->commands([AchievementMakeCommand::class, AchievementChainMakeCommand::class]);
}
$this->app['Gstt\Achievements\Achievement'] = static function ($app) {
$this->app[Achievement::class] = static function ($app) {
return $app['gstt.achievements.achievement'];
};
$this->publishes(
Expand Down
4 changes: 2 additions & 2 deletions src/Achiever.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
declare(strict_types=1);

namespace Gstt\Achievements;
namespace Assada\Achievements;

/**
* Trait Achiever
*
* @package Gstt\Achievements
* @package Assada\Achievements
*/
trait Achiever
{
Expand Down
4 changes: 2 additions & 2 deletions src/CanAchieve.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
declare(strict_types=1);

namespace Gstt\Achievements;
namespace Assada\Achievements;

/**
* Interface CanAchieve
*
* @package Gstt\Achievements
* @package Assada\Achievements
*/
interface CanAchieve
{
Expand Down
6 changes: 3 additions & 3 deletions src/Console/AchievementChainMakeCommand.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
declare(strict_types=1);

namespace Gstt\Achievements\Console;
namespace Assada\Achievements\Console;

use Illuminate\Console\GeneratorCommand;

/**
* Creates an achievement chain class stub.
*
* @category Command
* @package Gstt\Achievements\Command
* @package Assada\Achievements\Command
* @author Gabriel Simonetti <simonettigo@gmail.com>
* @license MIT License
* @link https://github.com/gstt/laravel-achievements
* @link https://github.com/assada/laravel-achievements
*/
class AchievementChainMakeCommand extends GeneratorCommand
{
Expand Down
Loading

0 comments on commit 69a78fd

Please sign in to comment.