1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Administrator
- * Date: 2019/4/29 0029
- * Time: 17:16
- */
- namespace App\Http\Logics\Admin;
- use App\Http\Models\LinkTask;
- use App\Http\Models\LinkTaskDetail;
- use App\Http\Models\LinkTaskUrl;
- use App\Http\Models\Permission;
- use App\Http\Models\Role;
- use App\Http\Models\User;
- use \Illuminate\Database\Eloquent\Builder;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Auth;
- use Illuminate\Support\Facades\DB;
- class RoleLogic
- {
- const Customer_Permissions = [21, 22, 23, 26, 32, 33, 34, 35, 36, 39, 40, 144, 145, 220, 221, 222, 223, 344, 345, 356, 357,384];
- public function getRoleCanPermissions($role)
- {
- $builder = Permission::query()->select(['title as name', 'id', 'parent_id', 'type']);
- if ($role->id == Role::TYPE_CUSTOMER) {
- $builder->whereIn('id', self::Customer_Permissions);
- }
- return $builder->get()->toArray();
- }
- }
|