diff --git a/extend.php b/extend.php index e8b9b0c..6bf4c5e 100644 --- a/extend.php +++ b/extend.php @@ -18,6 +18,7 @@ use Flarum\Extend; use Flarum\User\Event\Registered; use Flarum\User\Event\Saving as UserSaving; +use Flarum\User\User; use FoF\Doorman\Api\Controllers; use FoF\Doorman\Api\Serializers\DoorkeySerializer; use FoF\Doorman\Validators\DoorkeyLoginValidator; @@ -31,6 +32,9 @@ ->js(__DIR__.'/js/dist/admin.js') ->css(__DIR__.'/resources/less/admin.less'), + (new Extend\Model(User::class)) + ->cast('invite_code', 'string'), + (new Extend\Routes('api')) ->post('/fof/doorkeys', 'fof.doorkey.create', Controllers\CreateDoorkeyController::class) ->post('/fof/doorkeys/invites', 'fof.doorkey.invite', Controllers\SendInvitesController::class) diff --git a/src/Api/Controllers/ListDoorkeysController.php b/src/Api/Controllers/ListDoorkeysController.php index 974ca55..cf97742 100644 --- a/src/Api/Controllers/ListDoorkeysController.php +++ b/src/Api/Controllers/ListDoorkeysController.php @@ -22,9 +22,6 @@ class ListDoorkeysController extends AbstractListController { - /** - * @var DoorkeySerializer - */ public $serializer = DoorkeySerializer::class; /** diff --git a/src/Commands/EditDoorkeyHandler.php b/src/Commands/EditDoorkeyHandler.php index eea3a2f..b07d36c 100644 --- a/src/Commands/EditDoorkeyHandler.php +++ b/src/Commands/EditDoorkeyHandler.php @@ -36,11 +36,11 @@ public function __construct(DoorkeyValidator $validator) } /** - * @param EditRank $command + * @param EditDoorkey $command * * @throws PermissionDeniedException * - * @return Rank + * @return Doorkey */ public function handle(EditDoorkey $command) { diff --git a/src/Doorkey.php b/src/Doorkey.php index b90c971..32bb857 100644 --- a/src/Doorkey.php +++ b/src/Doorkey.php @@ -16,6 +16,13 @@ use Flarum\Database\AbstractModel; use Flarum\Group\Group; +/** + * @property string $key + * @property int $group_id + * @property int $max_uses + * @property int $activates + * @property int $uses + */ class Doorkey extends AbstractModel { /** diff --git a/src/Listeners/PostRegisterOperations.php b/src/Listeners/PostRegisterOperations.php index ec2b5ba..4ee6f0f 100644 --- a/src/Listeners/PostRegisterOperations.php +++ b/src/Listeners/PostRegisterOperations.php @@ -21,8 +21,16 @@ class PostRegisterOperations { + /** + * @var SettingsRepositoryInterface + */ protected $settings; + /** + * @var Dispatcher + */ + protected $events; + public function __construct(SettingsRepositoryInterface $settings, Dispatcher $events) { $this->settings = $settings;