����JFIF��x�x����'
Server IP : 78.140.185.180 / Your IP : 216.73.216.45 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/builderbox/www/common/Auth/Permissions/Traits/ |
Upload File : |
<?php namespace Common\Auth\Permissions\Traits; use App\User; use Common\Auth\Roles\Role; use Common\Billing\BillingPlan; use Illuminate\Database\Eloquent\Model; use Arr; trait SyncsPermissions { /** * @param User|BillingPlan|Role|Model $model * @param $permissions */ public function syncPermissions($model, $permissions) { $permissionIds = collect($permissions)->mapWithKeys(function($permission) { $restrictions = Arr::get($permission, 'restrictions', []); return [$permission['id'] => [ 'restrictions' => collect($restrictions) ->filter(function($restriction) { return isset($restriction['value']); })->map(function($restriction) { return ['name' => $restriction['name'], 'value' => $restriction['value']]; }), ]]; }); $model->permissions()->sync($permissionIds); } }