for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php namespace Modules\User\Repositories\Sentinel;
use Cartalyst\Sentinel\Laravel\Facades\Sentinel;
use Modules\User\Events\RoleWasUpdated;
use Modules\User\Repositories\RoleRepository;
class SentinelRoleRepository implements RoleRepository
{
/**
* @var \Cartalyst\Sentinel\Roles\EloquentRole
*/
protected $role;
public function __construct()
$this->role = Sentinel::getRoleRepository()->createModel();
}
* Return all the roles
* @return mixed
public function all()
return $this->role->all();
* Create a role resource
public function create($data)
$this->role->create($data);
* Find a role by its id
* @param $id
public function find($id)
return $this->role->find($id);
* Update a role
* @param $data
public function update($id, $data)
$role = $this->role->find($id);
$role->fill($data);
$role->save();
event(new RoleWasUpdated($role));
* Delete a role
public function delete($id)
return $role->delete();
* Find a role by its name
* @param string $name
public function findByName($name)
return Sentinel::findRoleByName($name);