本文整理汇总了PHP中Permission::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Permission::all方法的具体用法?PHP Permission::all怎么用?PHP Permission::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permission
的用法示例。
在下文中一共展示了Permission::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCreate
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function getCreate()
{
$permissions = $this->permission->all();
$selectedPermissions = Input::old('permissions', array());
$title = Lang::get('admin/roles/title.create_a_new_role');
return Theme::make('admin/roles/create', compact('permissions', 'selectedPermissions', 'title'));
}
示例2: create
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
// Get all the available permissions
$permissions = $this->permission->all();
// Selected permissions
$selectedPermissions = Input::old('permissions', array());
// Title
$title = Lang::get('admin/roles/title.create_a_new_role');
// Show the page
$this->render('admin/roles/create', compact('permissions', 'selectedPermissions', 'title'));
}
示例3: getCreate
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function getCreate()
{
$role = new Role();
// Get all the available permissions
$permissions = $this->permission->all();
// Selected permissions
$selectedPermissions = Input::old('permissions', array());
// Title
$title = Lang::get('admin/roles/title.create_a_new_role');
// Show the page
return View::make('admin/roles/edit', compact('role', 'permissions', 'selectedPermissions', 'title'));
}
示例4: run
public function run()
{
$admin = Role::where('name', '=', 'administrator')->first();
$perms = Permission::all();
$admin->perms()->sync(array_pluck($perms, 'id'));
$man = Role::where('name', '=', 'users manager')->first();
$perms = Permission::where('name', '=', 'manage_users')->orWhere('name', '=', 'delete_users')->get();
$man->perms()->sync(array_pluck($perms, 'id'));
$man = Role::where('name', '=', 'premium author')->first();
$perms = Permission::where('name', '=', 'manage_premium_casts')->orWhere('name', '=', 'manage_free_casts')->orWhere('name', '=', 'manage_series')->get();
$man->perms()->sync(array_pluck($perms, 'id'));
$man = Role::where('name', '=', 'author')->first();
$perms = Permission::where('name', '=', 'manage_free_casts')->orWhere('name', '=', 'manage_series')->get();
$man->perms()->sync(array_pluck($perms, 'id'));
$man = Role::where('name', '=', 'eraser')->first();
$perms = Permission::where('name', '=', 'delete_series')->orWhere('name', '=', 'delete_casts')->get();
$man->perms()->sync(array_pluck($perms, 'id'));
$man = Role::where('name', '=', 'premium user')->first();
$perms = Permission::where('name', '=', 'view_premium_casts')->orWhere('name', '=', 'view_free_casts')->get();
$man->perms()->sync(array_pluck($perms, 'id'));
$man = Role::where('name', '=', 'user')->first();
$perms = Permission::where('name', '=', 'view_free_casts')->get();
$man->perms()->sync(array_pluck($perms, 'id'));
$man = Role::where('name', '=', 'guest')->first();
$perms = Permission::where('name', '=', 'view_free_casts')->get();
$man->perms()->sync(array_pluck($perms, 'id'));
}
示例5: UserPermissions
public function UserPermissions()
{
if (Auth::check()) {
$user_id = Auth::id();
$cache_key = "user-" . $user_id . "-permissions";
if (Cache::tags('user-permissions')->has($cache_key)) {
$permission_array = Cache::tags('user-permissions')->get($cache_key);
} else {
if (Auth::user()->is_admin) {
$raw_permission_array = [];
$permission_array = [];
$permission_objects = Permission::all();
$user_permissions = DB::table('permission_user')->where('user_id', '=', $user_id)->get();
foreach ($user_permissions as $user_permission) {
$permission_id = $user_permission->permission_id;
$raw_permission_array[$permission_id] = 1;
}
foreach ($permission_objects as $permission) {
$route_name = $permission->route;
$permission_id = $permission->id;
if (isset($raw_permission_array[$permission_id])) {
$permission_array[$route_name] = $raw_permission_array[$permission_id];
} else {
$permission_array[$route_name] = 0;
}
}
} else {
$permission_array = false;
}
Cache::tags('user-permissions')->put($cache_key, $permission_array, 60);
}
}
return $permission_array;
}
示例6: run
public function run()
{
DB::table('roles')->delete();
$admin = Role::create(array('name' => 'admin'));
$permisos = Permission::all();
foreach ($permisos as $permiso) {
$admin->attachPermission($permiso);
}
}
示例7: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
// Show a listing of employees.
$employeeId = Session::get('userEmployeeId');
$employee = new Employee();
$employeeInfo = $employee->getEmployeeInfoById($employeeId);
$permissions = Permission::all();
return View::make('admin.indexpermission')->with('permissions', $permissions)->with('employeeInfo', $employeeInfo);
}
示例8: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
if (ACL::checkUserPermission('settings.permission') == false) {
return Redirect::action('dashboard');
}
$permission = Permission::all();
$title = Lang::get('Permission');
$acl = ACL::buildACL();
return View::make('permission/index', array('acl' => $acl, 'permissionList' => $permission, 'title' => $title));
}
示例9: vistaAsignarUsuarioPermiso
public function vistaAsignarUsuarioPermiso()
{
$usuarios = Usuario::orderBy('nombre')->get();
$perfiles = Role::where('estado', 'A')->get();
$permisos = Permission::all();
$this->array_view['usuarios'] = $usuarios;
$this->array_view['perfiles'] = $perfiles;
$this->array_view['permisos'] = $permisos;
return View::make($this->folder_name . '.permiso.asignar-usuario-permiso', $this->array_view);
}
示例10: editgroup
public function editgroup($id)
{
$employeeId = Session::get('userEmployeeId');
$employee = new Employee();
$employeeInfo = $employee->getEmployeeInfoById($employeeId);
// Show details of a user.
$group = Group::findOrFail($id);
$perms = array("view" => 1, "create" => 2, "update" => 3, "delete" => 4);
$permissions = Permission::all();
return View::make('admin.editgroup')->with('group', $group)->with('perms', $perms)->with('permissions', $permissions)->with('employeeInfo', $employeeInfo);
}
示例11: delete
/**
* Remove user.
*
* @param $user
* @return Response
*/
public function delete($user)
{
if ($user->id) {
$roles = $this->role->all();
$permissions = $this->permission->all();
// Title
$title = Lang::get('admin/user/title.user_delete');
return View::make('admin/user/delete', compact('user', 'roles', 'permissions', 'title'));
} else {
return Redirect::to('admin/user')->with('error', Lang::get('admin/user/messages.does_not_exist'));
}
}
示例12: getEdit
public function getEdit($user)
{
if ($user->id) {
$roles = $this->role->all();
$profiles = $user->profiles;
$permissions = $this->permission->all();
$title = Lang::get('admin/users/title.user_update');
$mode = 'edit';
return View::make('admin/users/create_edit', compact('user', 'roles', 'permissions', 'title', 'mode', 'profiles'));
} else {
return Redirect::to('admin/users')->with('error', Lang::get('admin/users/messages.does_not_exist'));
}
}
示例13: getEdit
/**
* edit user
*
* @return Response
*/
public function getEdit($user)
{
if ($user->id) {
$roles = $this->role->all();
$profiles = $user->profiles;
$permissions = $this->permission->all();
$title = Lang::get('admin/users/title.user_update');
$mode = 'edit';
$last_login = Activity::whereRaw('user_id = ? AND content_type="login"', array($user->id))->select(array('details'))->orderBy('id', 'DESC')->first();
return Theme::make('admin/users/create_edit', compact('user', 'roles', 'permissions', 'title', 'mode', 'profiles', 'last_login'));
} else {
return Api::to(array('error', Lang::get('admin/users/messages.does_not_exist'))) ?: Redirect::to('admin/users')->with('error', Lang::get('admin/users/messages.does_not_exist'));
}
}
示例14: edit
/**
* Show the form for editing the specified resource.
*
* @param $id
* @throws \Acme\Core\Exceptions\EntityNotFoundException
* @return Response
*/
public function edit($id)
{
$user = $this->userRepository->findById($id);
if ($user) {
$roles = $this->role->all();
$permissions = $this->permission->all();
// Title
$title = Lang::get('admin/users/title.user_update');
// mode
$mode = 'edit';
$this->render('admin.users.edit', compact('user', 'roles', 'permissions', 'title', 'mode'));
} else {
return Redirect::to('admin.users')->with('error', Lang::get('admin.users.messages.does_not_exist'));
}
}
示例15: edit
/**
* Show the form for editing the specified resource.
* GET /admin.permissions/{id}/edit
*
* @param int $id
* @return Response
*/
public function edit($id)
{
//Buscamos el permiso en cuestión y lo asignamos a la instancia
$permission = Permission::find($id);
$this->permission = $permission;
$title = 'Administración de catálogo de permisos del sistema';
//Título de sección:
$title_section = "Editar permiso: ";
//Subtítulo de sección:
$subtitle_section = $this->permission->display_name;
// Todos los permisos creados actualmente
$permissions = $this->permission->all();
//ID del permiso
$id = $permission->id;
return View::make('admin.permission.edit', compact('title', 'title_section', 'subtitle_section', 'permission', 'permissions', 'id'));
}