Laravel 4基于角色的批量分配 [英] Laravel 4 Role Based Mass Assignment

查看:89
本文介绍了Laravel 4基于角色的批量分配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用laravel,我很想知道laravel-4是否直接提供基于角色的大规模任务分配?

Ive justed started using laravel and I am curious to know if laravel-4 offers role based mass assignment straight out of the box ?

在编辑/更新信息时,我希望允许某些用户(通过批量分配)访问这些字段.

I wish to allow some users access to those fields(via mass assignment), when editing/updating Information.

我相信Rails Active记录具有此功能.

I believe Rails Active record has this feature.

class User < ActiveRecord::Base
  attr_accessible :first, :last, :email             # :default role
  attr_accessible :can_fire_missiles, :as => :admin # :admin role
end

推荐答案

不! Laravel没有开箱即用的角色"概念.这可能是一个很好的功能请求.

Nope! Laravel doesn't have the concept of "roles" out of the box. This may make for a good feature request.

您现在可以定义哪些字段是隐藏的",哪些字段是可见的",以及您要定义的哪些字段是(可分配的数量),它们是

You can, right now, define which fields are "hidden", which are "visible", and to your point, which are "fillable" (mass assignable) and which are not mass-assignable.

这篇关于Laravel 4基于角色的批量分配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆