-
Notifications
You must be signed in to change notification settings - Fork 336
/
Copy pathScope.php
59 lines (51 loc) · 1.73 KB
/
Scope.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
namespace Silber\Bouncer\Contracts;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
interface Scope
{
/**
* Append the tenant ID to the given cache key.
*
* @param string $key
* @return string
*/
public function appendToCacheKey($key);
/**
* Scope the given model to the current tenant.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @return \Illuminate\Database\Eloquent\Model
*/
public function applyToModel(Model $model);
/**
* Scope the given model query to the current tenant.
*
* @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $query
* @param string $table
* @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
*/
public function applyToModelQuery($query, $table);
/**
* Scope the given relationship query to the current tenant.
*
* @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $query
* @param string $table
* @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
*/
public function applyToRelationQuery($query, $table);
/**
* Scope the given relation to the current tenant.
*
* @param \Illuminate\Database\Eloquent\Relations\BelongsToMany $relation
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function applyToRelation(BelongsToMany $relation);
/**
* Get the additional attributes for pivot table records.
*
* @param string|null $authority
* @return array
*/
public function getAttachAttributes($authority = null);
}