1
0
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:
Franz Liedke
2017-06-24 12:09:22 +02:00
parent 927e4ca3ed
commit bdf455c0c6
5 changed files with 5 additions and 5 deletions

View File

@@ -0,0 +1,32 @@
<?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\Database;
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)
);
}
}