����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.170 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 : /proc/thread-self/root/home/builderbox/././www/common/Auth/Roles/ |
Upload File : |
<?php namespace Common\Auth\Roles;
use Illuminate\Http\Request;
use Common\Core\BaseController;
use Common\Auth\UserRepository;
class UserRolesController extends BaseController
{
/**
* UserRepository instance.
*
* @var UserRepository
*/
private $repository;
/**
* Laravel request instance.
*
* @var Request
*/
private $request;
/**
* UserRolesController constructor.
*
* @param UserRepository $repository
* @param Request $request
*/
public function __construct(UserRepository $repository, Request $request)
{
$this->repository = $repository;
$this->request = $request;
}
/**
* Attach specified roles to user.
*
* @param int $userId
* @return int
*/
public function attach($userId)
{
$user = $this->repository->findOrFail($userId);
$this->authorize('update', $user);
return $this->repository->attachRoles($user, $this->request->get('roles'), 'attach');
}
/**
* Detach specified roles from user.
*
* @param int $userId
* @return int
*/
public function detach($userId)
{
$user = $this->repository->findOrFail($userId);
$this->authorize('update', $user);
return $this->repository->detachRoles($user, $this->request->get('roles'));
}
}