Laravel 4 Role Based Mass Assignment

百般思念 提交于 2019-12-24 18:08:11

问题


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.

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

回答1:


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.



来源:https://stackoverflow.com/questions/18541364/laravel-4-role-based-mass-assignment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!