diff --git a/src/Admin/Controller/FrontendController.php b/src/Admin/Controller/FrontendController.php index d1b18d2ba..14258eb05 100644 --- a/src/Admin/Controller/FrontendController.php +++ b/src/Admin/Controller/FrontendController.php @@ -12,7 +12,7 @@ namespace Flarum\Admin\Controller; use Flarum\Admin\Frontend; -use Flarum\Core\Permission; +use Flarum\Group\Permission; use Flarum\Settings\Event\Deserializing; use Flarum\Extension\ExtensionManager; use Flarum\Frontend\AbstractFrontendController; diff --git a/src/Api/Controller/ListGroupsController.php b/src/Api/Controller/ListGroupsController.php index 66d734917..f02253810 100644 --- a/src/Api/Controller/ListGroupsController.php +++ b/src/Api/Controller/ListGroupsController.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Controller; -use Flarum\Core\Group; +use Flarum\Group\Group; use Psr\Http\Message\ServerRequestInterface; use Tobscure\JsonApi\Document; diff --git a/src/Api/Controller/SetPermissionController.php b/src/Api/Controller/SetPermissionController.php index 8eff7ccd9..edbc7cf20 100644 --- a/src/Api/Controller/SetPermissionController.php +++ b/src/Api/Controller/SetPermissionController.php @@ -12,7 +12,7 @@ namespace Flarum\Api\Controller; use Flarum\Core\Access\AssertPermissionTrait; -use Flarum\Core\Permission; +use Flarum\Group\Permission; use Flarum\Http\Controller\ControllerInterface; use Psr\Http\Message\ServerRequestInterface; use Zend\Diactoros\Response\EmptyResponse; diff --git a/src/Api/Controller/ShowForumController.php b/src/Api/Controller/ShowForumController.php index d221646e8..2dd3cd369 100644 --- a/src/Api/Controller/ShowForumController.php +++ b/src/Api/Controller/ShowForumController.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Controller; -use Flarum\Core\Group; +use Flarum\Group\Group; use Psr\Http\Message\ServerRequestInterface; use Tobscure\JsonApi\Document; diff --git a/src/Api/Serializer/GroupSerializer.php b/src/Api/Serializer/GroupSerializer.php index ba07e7754..7cd1eb989 100644 --- a/src/Api/Serializer/GroupSerializer.php +++ b/src/Api/Serializer/GroupSerializer.php @@ -11,7 +11,7 @@ namespace Flarum\Api\Serializer; -use Flarum\Core\Group; +use Flarum\Group\Group; use InvalidArgumentException; use Symfony\Component\Translation\TranslatorInterface; diff --git a/src/Core/Command/CreateGroupHandler.php b/src/Core/Command/CreateGroupHandler.php index 6c3be8830..299cf5804 100644 --- a/src/Core/Command/CreateGroupHandler.php +++ b/src/Core/Command/CreateGroupHandler.php @@ -13,10 +13,10 @@ namespace Flarum\Core\Command; use Flarum\Core\Access\AssertPermissionTrait; use Flarum\User\Exception\PermissionDeniedException; -use Flarum\Core\Group; +use Flarum\Group\Group; use Flarum\Foundation\DispatchEventsTrait; -use Flarum\Core\Validator\GroupValidator; -use Flarum\Event\GroupWillBeSaved; +use Flarum\Group\GroupValidator; +use Flarum\Group\Event\Saving; use Illuminate\Contracts\Events\Dispatcher; class CreateGroupHandler @@ -25,13 +25,13 @@ class CreateGroupHandler use AssertPermissionTrait; /** - * @var GroupValidator + * @var \Flarum\Group\GroupValidator */ protected $validator; /** * @param Dispatcher $events - * @param GroupValidator $validator + * @param \Flarum\Group\GroupValidator $validator */ public function __construct(Dispatcher $events, GroupValidator $validator) { @@ -41,7 +41,7 @@ class CreateGroupHandler /** * @param CreateGroup $command - * @return Group + * @return \Flarum\Group\Group * @throws \Flarum\User\Exception\PermissionDeniedException */ public function handle(CreateGroup $command) @@ -59,7 +59,7 @@ class CreateGroupHandler ); $this->events->fire( - new GroupWillBeSaved($group, $actor, $data) + new Saving($group, $actor, $data) ); $this->validator->assertValid($group->getAttributes()); diff --git a/src/Core/Command/DeleteGroupHandler.php b/src/Core/Command/DeleteGroupHandler.php index e3ee47543..9755311cd 100644 --- a/src/Core/Command/DeleteGroupHandler.php +++ b/src/Core/Command/DeleteGroupHandler.php @@ -13,9 +13,9 @@ namespace Flarum\Core\Command; use Flarum\Core\Access\AssertPermissionTrait; use Flarum\User\Exception\PermissionDeniedException; -use Flarum\Core\Repository\GroupRepository; +use Flarum\Group\GroupRepository; use Flarum\Foundation\DispatchEventsTrait; -use Flarum\Event\GroupWillBeDeleted; +use Flarum\Group\Event\Deleting; use Illuminate\Contracts\Events\Dispatcher; class DeleteGroupHandler @@ -39,7 +39,7 @@ class DeleteGroupHandler /** * @param DeleteGroup $command - * @return \Flarum\Core\Group + * @return \Flarum\Group\Group * @throws PermissionDeniedException */ public function handle(DeleteGroup $command) @@ -51,7 +51,7 @@ class DeleteGroupHandler $this->assertCan($actor, 'delete', $group); $this->events->fire( - new GroupWillBeDeleted($group, $actor, $command->data) + new Deleting($group, $actor, $command->data) ); $group->delete(); diff --git a/src/Core/Command/EditGroupHandler.php b/src/Core/Command/EditGroupHandler.php index 42fe0e0a7..1425f59df 100644 --- a/src/Core/Command/EditGroupHandler.php +++ b/src/Core/Command/EditGroupHandler.php @@ -13,11 +13,11 @@ namespace Flarum\Core\Command; use Flarum\Core\Access\AssertPermissionTrait; use Flarum\User\Exception\PermissionDeniedException; -use Flarum\Core\Group; -use Flarum\Core\Repository\GroupRepository; +use Flarum\Group\Group; +use Flarum\Group\GroupRepository; use Flarum\Foundation\DispatchEventsTrait; -use Flarum\Core\Validator\GroupValidator; -use Flarum\Event\GroupWillBeSaved; +use Flarum\Group\GroupValidator; +use Flarum\Group\Event\Saving; use Illuminate\Contracts\Events\Dispatcher; class EditGroupHandler @@ -26,7 +26,7 @@ class EditGroupHandler use AssertPermissionTrait; /** - * @var GroupRepository + * @var \Flarum\Group\GroupRepository */ protected $groups; @@ -76,7 +76,7 @@ class EditGroupHandler } $this->events->fire( - new GroupWillBeSaved($group, $actor, $data) + new Saving($group, $actor, $data) ); $this->validator->assertValid($group->getDirty()); diff --git a/src/Core/CoreServiceProvider.php b/src/Core/CoreServiceProvider.php index 088733ce8..ed79cbfaf 100644 --- a/src/Core/CoreServiceProvider.php +++ b/src/Core/CoreServiceProvider.php @@ -114,7 +114,7 @@ class CoreServiceProvider extends AbstractServiceProvider $events->subscribe('Flarum\Discussion\DiscussionRenamedNotifier'); $events->subscribe('Flarum\Discussion\DiscussionPolicy'); - $events->subscribe('Flarum\Core\Access\GroupPolicy'); + $events->subscribe('Flarum\Group\GroupPolicy'); $events->subscribe('Flarum\Post\PostPolicy'); $events->subscribe('Flarum\User\UserPolicy'); diff --git a/src/Event/GroupWasCreated.php b/src/Group/Event/Created.php similarity index 84% rename from src/Event/GroupWasCreated.php rename to src/Group/Event/Created.php index 2e4962809..109c615d6 100644 --- a/src/Event/GroupWasCreated.php +++ b/src/Group/Event/Created.php @@ -9,15 +9,15 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Group\Event; -use Flarum\Core\Group; +use Flarum\Group\Group; use Flarum\User\User; -class GroupWasCreated +class Created { /** - * @var Group + * @var \Flarum\Group\Group */ public $group; diff --git a/src/Event/GroupWasDeleted.php b/src/Group/Event/Deleted.php similarity index 78% rename from src/Event/GroupWasDeleted.php rename to src/Group/Event/Deleted.php index 1d2290b7b..6fbc5fbc1 100644 --- a/src/Event/GroupWasDeleted.php +++ b/src/Group/Event/Deleted.php @@ -9,15 +9,15 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Group\Event; -use Flarum\Core\Group; +use Flarum\Group\Group; use Flarum\User\User; -class GroupWasDeleted +class Deleted { /** - * @var Group + * @var \Flarum\Group\Group */ public $group; @@ -27,7 +27,7 @@ class GroupWasDeleted public $actor; /** - * @param Group $group + * @param \Flarum\Group\Group $group * @param User $actor */ public function __construct(Group $group, User $actor = null) diff --git a/src/Event/GroupWillBeDeleted.php b/src/Group/Event/Deleting.php similarity index 92% rename from src/Event/GroupWillBeDeleted.php rename to src/Group/Event/Deleting.php index ac0d5b406..1c91063e1 100644 --- a/src/Event/GroupWillBeDeleted.php +++ b/src/Group/Event/Deleting.php @@ -9,12 +9,12 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Group\Event; -use Flarum\Core\Group; +use Flarum\Group\Group; use Flarum\User\User; -class GroupWillBeDeleted +class Deleting { /** * The group that will be deleted. diff --git a/src/Event/GroupWasRenamed.php b/src/Group/Event/Renamed.php similarity index 78% rename from src/Event/GroupWasRenamed.php rename to src/Group/Event/Renamed.php index ded05ce98..c9c201872 100644 --- a/src/Event/GroupWasRenamed.php +++ b/src/Group/Event/Renamed.php @@ -9,15 +9,15 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Group\Event; -use Flarum\Core\Group; +use Flarum\Group\Group; use Flarum\User\User; -class GroupWasRenamed +class Renamed { /** - * @var Group + * @var \Flarum\Group\Group */ public $group; @@ -27,7 +27,7 @@ class GroupWasRenamed public $actor; /** - * @param Group $group + * @param \Flarum\Group\Group $group * @param User $actor */ public function __construct(Group $group, User $actor = null) diff --git a/src/Event/GroupWillBeSaved.php b/src/Group/Event/Saving.php similarity index 90% rename from src/Event/GroupWillBeSaved.php rename to src/Group/Event/Saving.php index feeaac887..2dd019dca 100644 --- a/src/Event/GroupWillBeSaved.php +++ b/src/Group/Event/Saving.php @@ -9,17 +9,17 @@ * file that was distributed with this source code. */ -namespace Flarum\Event; +namespace Flarum\Group\Event; -use Flarum\Core\Group; +use Flarum\Group\Group; use Flarum\User\User; -class GroupWillBeSaved +class Saving { /** * The group that will be saved. * - * @var Group + * @var \Flarum\Group\Group */ public $group; diff --git a/src/Core/Group.php b/src/Group/Group.php similarity index 88% rename from src/Core/Group.php rename to src/Group/Group.php index 53d4da36f..dd30cbb53 100755 --- a/src/Core/Group.php +++ b/src/Group/Group.php @@ -9,14 +9,14 @@ * file that was distributed with this source code. */ -namespace Flarum\Core; +namespace Flarum\Group; use Flarum\Foundation\EventGeneratorTrait; use Flarum\Database\ScopeVisibilityTrait; use Flarum\Database\AbstractModel; -use Flarum\Event\GroupWasCreated; -use Flarum\Event\GroupWasDeleted; -use Flarum\Event\GroupWasRenamed; +use Flarum\Group\Event\Created; +use Flarum\Group\Event\Deleting; +use Flarum\Group\Event\Renamed; /** * @property int $id @@ -67,7 +67,7 @@ class Group extends AbstractModel parent::boot(); static::deleted(function (Group $group) { - $group->raise(new GroupWasDeleted($group)); + $group->raise(new Deleting($group)); $group->permissions()->delete(); }); @@ -91,7 +91,7 @@ class Group extends AbstractModel $group->color = $color; $group->icon = $icon; - $group->raise(new GroupWasCreated($group)); + $group->raise(new Created($group)); return $group; } @@ -108,7 +108,7 @@ class Group extends AbstractModel $this->name_singular = $nameSingular; $this->name_plural = $namePlural; - $this->raise(new GroupWasRenamed($this)); + $this->raise(new Renamed($this)); return $this; } @@ -130,6 +130,6 @@ class Group extends AbstractModel */ public function permissions() { - return $this->hasMany('Flarum\Core\Permission'); + return $this->hasMany('Flarum\Group\Permission'); } } diff --git a/src/Core/Access/GroupPolicy.php b/src/Group/GroupPolicy.php similarity index 92% rename from src/Core/Access/GroupPolicy.php rename to src/Group/GroupPolicy.php index ff9861a07..91af563a8 100644 --- a/src/Core/Access/GroupPolicy.php +++ b/src/Group/GroupPolicy.php @@ -9,9 +9,8 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Access; +namespace Flarum\Group; -use Flarum\Core\Group; use Flarum\User\AbstractPolicy; use Flarum\User\User; diff --git a/src/Core/Repository/GroupRepository.php b/src/Group/GroupRepository.php similarity index 95% rename from src/Core/Repository/GroupRepository.php rename to src/Group/GroupRepository.php index f6cfe3d82..4372fa560 100644 --- a/src/Core/Repository/GroupRepository.php +++ b/src/Group/GroupRepository.php @@ -9,9 +9,8 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Repository; +namespace Flarum\Group; -use Flarum\Core\Group; use Flarum\User\User; use Illuminate\Database\Eloquent\Builder; @@ -33,7 +32,7 @@ class GroupRepository * * @param int $id * @param User $actor - * @return Group + * @return \Flarum\Group\Group * * @throws \Illuminate\Database\Eloquent\ModelNotFoundException */ diff --git a/src/Core/Validator/GroupValidator.php b/src/Group/GroupValidator.php similarity index 92% rename from src/Core/Validator/GroupValidator.php rename to src/Group/GroupValidator.php index 506163f6f..58d8aee16 100644 --- a/src/Core/Validator/GroupValidator.php +++ b/src/Group/GroupValidator.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Flarum\Core\Validator; +namespace Flarum\Group; use Flarum\Foundation\AbstractValidator; diff --git a/src/Core/Permission.php b/src/Group/Permission.php similarity index 93% rename from src/Core/Permission.php rename to src/Group/Permission.php index 21bd7d88a..0ed470e3b 100755 --- a/src/Core/Permission.php +++ b/src/Group/Permission.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Flarum\Core; +namespace Flarum\Group; use Flarum\Database\AbstractModel; use Illuminate\Database\Eloquent\Builder; @@ -31,7 +31,7 @@ class Permission extends AbstractModel */ public function group() { - return $this->belongsTo('Flarum\Core\Group', 'group_id'); + return $this->belongsTo('Flarum\Group\Group', 'group_id'); } /** diff --git a/src/Install/Console/InstallCommand.php b/src/Install/Console/InstallCommand.php index acf67997d..ace02e89b 100644 --- a/src/Install/Console/InstallCommand.php +++ b/src/Install/Console/InstallCommand.php @@ -13,8 +13,8 @@ namespace Flarum\Install\Console; use Exception; use Flarum\Console\AbstractCommand; -use Flarum\Core\Group; -use Flarum\Core\Permission; +use Flarum\Group\Group; +use Flarum\Group\Permission; use Flarum\User\User; use Flarum\Database\AbstractModel; use Illuminate\Contracts\Foundation\Application; diff --git a/src/User/Event/GroupsChanged.php b/src/User/Event/GroupsChanged.php index feb6484d7..310d70fb7 100644 --- a/src/User/Event/GroupsChanged.php +++ b/src/User/Event/GroupsChanged.php @@ -23,7 +23,7 @@ class GroupsChanged public $user; /** - * @var \Flarum\Core\Group[] + * @var \Flarum\Group\Group[] */ public $oldGroups; @@ -34,7 +34,7 @@ class GroupsChanged /** * @param User $user The user whose groups were changed. - * @param \Flarum\Core\Group[] $oldGroups + * @param \Flarum\Group\Group[] $oldGroups * @param User $actor */ public function __construct(User $user, array $oldGroups, User $actor = null) diff --git a/src/User/Guest.php b/src/User/Guest.php index e62b8c695..e7dc3f502 100755 --- a/src/User/Guest.php +++ b/src/User/Guest.php @@ -11,7 +11,7 @@ namespace Flarum\User; -use Flarum\Core\Group; +use Flarum\Group\Group; class Guest extends User { @@ -25,7 +25,7 @@ class Guest extends User /** * Get the guest's group, containing only the 'guests' group model. * - * @return Group + * @return \Flarum\Group\Group */ public function getGroupsAttribute() { diff --git a/src/User/Search/Gambit/GroupGambit.php b/src/User/Search/Gambit/GroupGambit.php index b8c627bde..317ea8232 100644 --- a/src/User/Search/Gambit/GroupGambit.php +++ b/src/User/Search/Gambit/GroupGambit.php @@ -11,7 +11,7 @@ namespace Flarum\Core\User\Search\Gambit; -use Flarum\Core\Repository\GroupRepository; +use Flarum\Group\GroupRepository; use Flarum\Search\AbstractRegexGambit; use Flarum\Search\AbstractSearch; use Flarum\Core\User\Search\UserSearch; @@ -30,7 +30,7 @@ class GroupGambit extends AbstractRegexGambit protected $groups; /** - * @param \Flarum\Core\Repository\GroupRepository $groups + * @param \Flarum\Group\GroupRepository $groups */ public function __construct(GroupRepository $groups) { diff --git a/src/User/User.php b/src/User/User.php index f85470449..24a6ab8bb 100755 --- a/src/User/User.php +++ b/src/User/User.php @@ -13,9 +13,9 @@ namespace Flarum\User; use DomainException; use Flarum\User\Gate; -use Flarum\Core\Group; +use Flarum\Group\Group; use Flarum\Core\Notification; -use Flarum\Core\Permission; +use Flarum\Group\Permission; use Flarum\Foundation\EventGeneratorTrait; use Flarum\Database\ScopeVisibilityTrait; use Flarum\Database\AbstractModel; @@ -623,7 +623,7 @@ class User extends AbstractModel */ public function groups() { - return $this->belongsToMany('Flarum\Core\Group', 'users_groups'); + return $this->belongsToMany('Flarum\Group\Group', 'users_groups'); } /**