mirror of
https://github.com/flarum/core.git
synced 2025-10-12 07:24:27 +02:00
Move ScopeVisibilityTrait to Database namespace
This commit is contained in:
@@ -13,7 +13,7 @@ namespace Flarum\Core;
|
||||
|
||||
use Flarum\Core\Post\MergeableInterface;
|
||||
use Flarum\Core\Support\EventGeneratorTrait;
|
||||
use Flarum\Core\Support\ScopeVisibilityTrait;
|
||||
use Flarum\Database\ScopeVisibilityTrait;
|
||||
use Flarum\Database\AbstractModel;
|
||||
use Flarum\Event\DiscussionWasDeleted;
|
||||
use Flarum\Event\DiscussionWasHidden;
|
||||
|
@@ -12,7 +12,7 @@
|
||||
namespace Flarum\Core;
|
||||
|
||||
use Flarum\Core\Support\EventGeneratorTrait;
|
||||
use Flarum\Core\Support\ScopeVisibilityTrait;
|
||||
use Flarum\Database\ScopeVisibilityTrait;
|
||||
use Flarum\Database\AbstractModel;
|
||||
use Flarum\Event\GroupWasCreated;
|
||||
use Flarum\Event\GroupWasDeleted;
|
||||
|
@@ -13,7 +13,7 @@ namespace Flarum\Core;
|
||||
|
||||
use Flarum\Core\Post\RegisteredTypesScope;
|
||||
use Flarum\Core\Support\EventGeneratorTrait;
|
||||
use Flarum\Core\Support\ScopeVisibilityTrait;
|
||||
use Flarum\Database\ScopeVisibilityTrait;
|
||||
use Flarum\Database\AbstractModel;
|
||||
use Flarum\Event\PostWasDeleted;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Core\Support;
|
||||
|
||||
use Flarum\Core\User;
|
||||
use Flarum\Event\ScopeModelVisibility;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
trait ScopeVisibilityTrait
|
||||
{
|
||||
/**
|
||||
* Scope a query to only include records that are visible to a user.
|
||||
*
|
||||
* @param Builder $query
|
||||
* @param User $actor
|
||||
*/
|
||||
public function scopeWhereVisibleTo(Builder $query, User $actor)
|
||||
{
|
||||
static::$dispatcher->fire(
|
||||
new ScopeModelVisibility($query->getModel(), $query, $actor)
|
||||
);
|
||||
}
|
||||
}
|
@@ -14,7 +14,7 @@ namespace Flarum\Core;
|
||||
use DomainException;
|
||||
use Flarum\Core\Access\Gate;
|
||||
use Flarum\Core\Support\EventGeneratorTrait;
|
||||
use Flarum\Core\Support\ScopeVisibilityTrait;
|
||||
use Flarum\Database\ScopeVisibilityTrait;
|
||||
use Flarum\Database\AbstractModel;
|
||||
use Flarum\Event\CheckUserPassword;
|
||||
use Flarum\Event\ConfigureUserPreferences;
|
||||
|
Reference in New Issue
Block a user