CheckPermissionTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 13
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkPermission() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: guoliang
5
 * Date: 2019/3/11
6
 * Time: 上午10:17.
7
 */
8
9
namespace Modules\Core\Traits\Repository;
10
11
trait CheckPermissionTrait
12
{
13
    /**
14
     * 检查权限.
15
     *
16
     * @param \Illuminate\Foundation\Auth\User $user
17
     * @param int                              $id
18
     *
19
     * @return bool
20
     */
21
    public function checkPermission($user, int $id)
22
    {
23
        return $this->model->where(['id' => $id, 'user_id' => $user->id])->exists();
24
    }
25
}
26