����JFIF��x�x����'
| Server IP : 78.140.185.180  /  Your IP : 216.73.216.38 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/././././././public_html/common/Auth/Roles/  | 
Upload File :  | 
<?php
namespace Common\Auth\Roles;
use Common\Auth\Permissions\Traits\SyncsPermissions;
use Arr;
class CrupdateRole
{
    use SyncsPermissions;
    /**
     * @var Role
     */
    private $role;
    /**
     * @param Role $role
     */
    public function __construct(Role $role)
    {
        $this->role = $role;
    }
    /**
     * @param array $data
     * @param Role $role
     * @return Role
     */
    public function execute($data, $role = null)
    {
        if ( ! $role) {
            $role = $this->role->newInstance([]);
        }
        $attributes = [
            'name' => $data['name'],
            'description' => $data['description'] ?? null,
            'default' => $data['default'] ?? false,
            'guests' => $data['guests'] ?? false,
            'type' => $data['type'] ?? 'sitewide',
        ];
        $role->fill($attributes)->save();
        // always sync permissions, detach all if "null" is given as permissions
        $this->syncPermissions($role, Arr::get($data, 'permissions', []));
        return $role;
    }
}