コード例 #1
0
ファイル: UserController.php プロジェクト: nelug/encuesta
 public function no_assigned($user_id)
 {
     $no_assigned = EntrustRole::whereNotIn('id', function ($query) use($user_id) {
         $query->select(DB::raw('role_id'))->from('assigned_roles')->whereRaw("user_id = ?", array($user_id));
     })->lists('name', 'id');
     return $no_assigned;
 }
コード例 #2
0
ファイル: Role.php プロジェクト: Aranjedeath/Laravel_Starter
 public function delete()
 {
     $id = $this->id;
     if (!parent::delete()) {
         return false;
     }
     return !$this->find($id) ? true : false;
 }
コード例 #3
0
ファイル: Role.php プロジェクト: wyrover/laravel-users
 /**
  * Update the model in the database.
  *
  * @param  array  $attributes
  * @return bool|int
  */
 public function update(array $attributes = [])
 {
     if (!parent::update($attributes)) {
         throw new Exception('Cannot update role.');
         // @codeCoverageIgnore
     }
     return $this->fresh();
 }
コード例 #4
0
 public function run()
 {
     DB::table('permission_role')->delete();
     /*
             Permissions::create(['name' => 'article.create'           , 'display_name' => 'New Article'              , 'description' => 'Create a New Article'             ]);
             Permissions::create(['name' => 'article.edit'             , 'display_name' => 'Update Article'           , 'description' => 'Update an Article'                ]);
             Permissions::create(['name' => 'inboundOrder.create'      , 'display_name' => 'New InboundOrder'         , 'description' => 'Create a New Inbound Order'       ]);
             Permissions::create(['name' => 'inboundOrder.edit'        , 'display_name' => 'Update InboundOrder'      , 'description' => 'Update an Inbound Order'          ]);
             Permissions::create(['name' => 'inboundOrderDetail.create', 'display_name' => 'New InboundOrderDetail'   , 'description' => 'Create a New Inbound Order Detail']);
             Permissions::create(['name' => 'inboundOrderDetail.edit'  , 'display_name' => 'Update InboundOrderDetail', 'description' => 'Update an Inbound Order Detail'   ]);
             Permissions::create(['name' => 'inventory.create'         , 'display_name' => 'New Inventory'            , 'description' => 'Create a New Inventory'           ]);
             Permissions::create(['name' => 'inventory.edit'           , 'display_name' => 'Update Inventory'         , 'description' => 'Update Inventory'                 ]);
             Permissions::create(['name' => 'location.create'          , 'display_name' => 'New Location'             , 'description' => 'Create a New Location'            ]);
             Permissions::create(['name' => 'location.edit'            , 'display_name' => 'Update Location'          , 'description' => 'Update a Location'                ]);
             Permissions::create(['name' => 'pallet.create'            , 'display_name' => 'New Pallet'               , 'description' => 'Create a New Pallet'              ]);
             Permissions::create(['name' => 'pallet.edit'              , 'display_name' => 'Update Pallet'            , 'description' => 'Update a Pallet'                  ]);
             Permissions::create(['name' => 'tote.create'              , 'display_name' => 'New Tote'                 , 'description' => 'Create a New Tote'                ]);
             Permissions::create(['name' => 'tote.edit'                , 'display_name' => 'Update Tote'              , 'description' => 'Update a Tote'                    ]);
             Permissions::create(['name' => 'upc.create'               , 'display_name' => 'New UPC'                  , 'description' => 'Create a New UPC'                 ]);
             Permissions::create(['name' => 'upc.edit'                 , 'display_name' => 'Update UPC'               , 'description' => 'Update a UPC'                     ]);
             Permissions::create(['name' => 'userActivity.create'      , 'display_name' => 'New UserActivity'         , 'description' => 'Create a New User Activity'       ]);
             Permissions::create(['name' => 'userActivity.edit'        , 'display_name' => 'Update UserActivity'      , 'description' => 'Update an User Activity'          ]);
     
             Role::create(['name' => 'receiver'      , 'display_name' => 'Receiver'                , 'description' => 'Receiver worker at a rework table'      ]);
             Role::create(['name' => 'putAwayReserve', 'display_name' => 'Put Away to reserve'     , 'description' => 'Put Away to reserve locations'          ]);
             Role::create(['name' => 'putAwayPick'   , 'display_name' => 'Put Away to pick face'   , 'description' => 'Put Away to pick face locations'        ]);
             Role::create(['name' => 'replen'        , 'display_name' => 'Replen'                  , 'description' => 'Move Inventory from reserve to pick face locations']);
             Role::create(['name' => 'poReconcile'   , 'display_name' => 'PO Receipt Reconciliator', 'description' => 'Reconcile Receipt POs variances'        ]);
             Role::create(['name' => 'teamLead'      , 'display_name' => 'Shift Team Leader'       , 'description' => 'Team Lead for the shift'                ]);
             Role::create(['name' => 'super'         , 'display_name' => 'Shift Supervisor'        , 'description' => 'Supervising the shift'                  ]);
             Role::create(['name' => 'manager'       , 'display_name' => 'Shift Manager'           , 'description' => 'Managing shift activities'              ]);
             Role::create(['name' => 'admin'         , 'display_name' => 'Administrator'           , 'description' => 'Administrates users of this application']);
             Role::create(['name' => 'support'       , 'display_name' => 'IT Support'              , 'description' => 'IT Support for this application'        ]);
     */
     $roles = Role::whereRaw("name in ('receiver', 'putAwayReserve', 'putAwayPick', 'replen', 'poReconcile', 'teamLead', 'super', 'manager', 'support')")->get();
     $permissions = Permission::whereRaw("name in ('none')")->get();
     foreach ($roles as $role) {
         foreach ($permissions as $permission) {
             DB::table('permission_role')->insert(['role_id' => $role->id, 'permission_id' => $permission->id]);
         }
     }
     $roles = Role::whereRaw("name in ('teamLead', 'super', 'manager', 'support')")->get();
     $permissions = Permission::whereRaw("name in ('article.create', 'article.edit', 'location.create', 'location.edit', 'pallet.create', 'pallet.edit'\n                                                    , 'tote.create', 'tote.edit', 'upc.create', 'upc.edit'\n                                                    , 'userActivity.create', 'userActivity.edit')")->get();
     foreach ($roles as $role) {
         foreach ($permissions as $permission) {
             DB::table('permission_role')->insert(['role_id' => $role->id, 'permission_id' => $permission->id]);
         }
     }
     $roles = Role::whereName('support')->get();
     $permissions = Permission::whereRaw("name in ('inboundOrder.create', 'inboundOrder.edit', 'inboundOrderDetail.create', 'inboundOrderDetail.edit'\n                                                    , 'inventory.create', 'inventory.edit'\n                                                    , 'receiptHistory.create', 'receiptHistory.edit', 'userConversation.create', 'userConversation.edit')")->get();
     foreach ($roles as $role) {
         foreach ($permissions as $permission) {
             DB::table('permission_role')->insert(['role_id' => $role->id, 'permission_id' => $permission->id]);
         }
     }
 }
コード例 #5
0
ファイル: Role.php プロジェクト: xjtuwangke/laravel-bundles
 /**
  * @param array $options
  * @return bool
  */
 public function save(array $options = array())
 {
     \DB::beginTransaction();
     if (is_array($this->dirty_perms)) {
         $this->setPermissionsAttribute($this->dirty_perms);
         $this->dirty_perms = null;
     }
     $result = parent::save($options);
     \DB::commit();
     return $result;
 }
コード例 #6
0
 public function run()
 {
     DB::table('roles')->delete();
     /*
     * select * from roles;
             +----+-----------------------+-------------------------------------+--------------------------------------------------------------------------------------+---------------------+---------------------+
             | id | name                  | display_name                        | description                                                                          | created_at          | updated_at          |
             +----+-----------------------+-------------------------------------+--------------------------------------------------------------------------------------+---------------------+---------------------+
             |  1 | receive               | Receiver                            | Receiver worker at a rework table                                                    | 2015-02-19 01:51:05 | 2015-02-19 01:51:05 |
             |  2 | receiveSuper          | Receiver Supervisor                 | Receiver supervising the rework tables                                               | 2015-02-19 01:52:05 | 2015-02-19 01:52:05 |
             |  3 | receiveManager        | Receiver Manager                    | Receiver managing the receiving operations                                           | 2015-02-19 01:53:12 | 2015-02-19 01:53:12 |
             |  4 | putawayReserve        | Put Away to reserve                 | Put Away to reserve locations                                                        | 2015-02-19 11:23:03 | 2015-02-19 11:23:03 |
             |  5 | putawayReserveSuper   | Put Away to reserve Supervisor      | Supervising Put Away to reserve locations                                            | 2015-02-19 11:23:47 | 2015-02-19 11:23:47 |
             |  6 | putawayReserveManager | Put Away to reserve Manager         | Managing Put Away to reserve locations                                               | 2015-02-19 11:24:20 | 2015-02-19 11:24:20 |
             |  7 | putawayPick           | Put Away to pick face               | Put Away to forward pick face locations                                              | 2015-02-19 11:24:53 | 2015-02-19 11:24:53 |
             |  8 | putawayPickSuper      | Put Away to pick face Supervisor    | Supervising Put Away to forward pick face locations                                  | 2015-02-19 11:25:22 | 2015-02-19 11:25:22 |
             |  9 | putawayPickManager    | Put Away to pick face Manager       | Managing Put Away to forward pick face locations                                     | 2015-02-19 11:25:48 | 2015-02-19 11:25:48 |
             | 10 | replen                | Replen                              | Remove Inventory from reserve locations to place into transfer locations             | 2015-02-19 11:30:12 | 2015-02-19 11:30:12 |
             | 11 | replenSuper           | Replen Supervisor                   | Supervising Remove Inventory from reserve locations to place into transfer locations | 2015-02-19 11:30:51 | 2015-02-19 11:30:51 |
             | 12 | replenManager         | Replen Manager                      | Managing Remove Inventory from reserve locations to place into transfer locations    | 2015-02-19 11:32:07 | 2015-02-19 11:32:07 |
             | 13 | poReconcile           | PO Receipt Reconciliator            | Reconcile Receipt POs variances                                                      | 2015-02-19 11:43:41 | 2015-02-19 11:43:41 |
             | 14 | poReconcileSuper      | PO Receipt Reconciliator Supervisor | Supervising Reconcile Receipt POs variances                                          | 2015-02-19 11:44:10 | 2015-02-19 11:44:10 |
             | 15 | poReconcileManager    | PO Receipt Reconciliator Manager    | Managing Reconcile Receipt POs variances                                             | 2015-02-19 11:44:35 | 2015-02-19 11:44:35 |
             | 16 | admin                 | Administrator                       | Administrates users of this application                                              | 2015-02-19 11:46:39 | 2015-02-19 11:46:39 |
             | 17 | support               | IT Support                          | IT Support for this application                                                      | 2015-02-19 12:24:18 | 2015-02-19 12:24:18 |
             +----+-----------------------+-------------------------------------+--------------------------------------------------------------------------------------+---------------------+---------------------+
     */
     Role::create(['name' => 'receive', 'display_name' => 'Receiver', 'description' => 'Receiver worker at a rework table']);
     Role::create(['name' => 'putAwayReserve', 'display_name' => 'Put Away to reserve', 'description' => 'Put Away to reserve locations']);
     Role::create(['name' => 'putAwayPick', 'display_name' => 'Put Away to pick face', 'description' => 'Put Away to pick face locations']);
     Role::create(['name' => 'replen', 'display_name' => 'Replen', 'description' => 'Move Inventory from reserve to pick face locations']);
     Role::create(['name' => 'poReconcile', 'display_name' => 'PO Receipt Reconciliator', 'description' => 'Reconcile Receipt POs variances']);
     Role::create(['name' => 'teamLead', 'display_name' => 'Shift Team Leader', 'description' => 'Team Lead for the shift']);
     Role::create(['name' => 'super', 'display_name' => 'Shift Supervisor', 'description' => 'Supervising the shift']);
     Role::create(['name' => 'manager', 'display_name' => 'Shift Manager', 'description' => 'Managing shift activities']);
     Role::create(['name' => 'admin', 'display_name' => 'Administrator', 'description' => 'Administrates users of this application']);
     Role::create(['name' => 'support', 'display_name' => 'IT Support', 'description' => 'IT Support for this application']);
 }
コード例 #7
0
ファイル: Role.php プロジェクト: aysenli/admin
 public static function boot()
 {
     parent::boot();
     self::observe(new BaseObservers());
 }
コード例 #8
0
 public function run()
 {
     DB::table('role_user')->delete();
     /*
             Role::create(['name' => 'receipt'       , 'display_name' => 'Receiver'                , 'description' => 'Receiver worker at a rework table'      ]);
             Role::create(['name' => 'putAwayReserve', 'display_name' => 'Put Away to reserve'     , 'description' => 'Put Away to reserve locations'          ]);
             Role::create(['name' => 'putAwayPick'   , 'display_name' => 'Put Away to pick face'   , 'description' => 'Put Away to pick face locations'        ]);
             Role::create(['name' => 'replen'        , 'display_name' => 'Replen'                  , 'description' => 'Move Inventory from reserve to pick face locations']);
             Role::create(['name' => 'poReconcile'   , 'display_name' => 'PO Receipt Reconciliator', 'description' => 'Reconcile Receipt POs variances'        ]);
             Role::create(['name' => 'teamLead'      , 'display_name' => 'Shift Team Leader'       , 'description' => 'Team Lead for the shift'                ]);
             Role::create(['name' => 'super'         , 'display_name' => 'Shift Supervisor'        , 'description' => 'Supervising the shift'                  ]);
             Role::create(['name' => 'manager'       , 'display_name' => 'Shift Manager'           , 'description' => 'Managing shift activities'              ]);
             Role::create(['name' => 'admin'         , 'display_name' => 'Administrator'           , 'description' => 'Administrates users of this application']);
             Role::create(['name' => 'support'       , 'display_name' => 'IT Support'              , 'description' => 'IT Support for this application'        ]);
     
             User::create(['name' => 'worker' , 'email' => '*****@*****.**' , 'password' => Hash::make( 'vital123' )]);
             User::create(['name' => 'teamLead'  , 'email' => '*****@*****.**'  , 'password' => Hash::make( 'vital123' )]);
             User::create(['name' => 'super'  , 'email' => '*****@*****.**'  , 'password' => Hash::make( 'vital123' )]);
             User::create(['name' => 'manager', 'email' => '*****@*****.**', 'password' => Hash::make( 'vital123' )]);
             User::create(['name' => 'admin'  , 'email' => '*****@*****.**'  , 'password' => Hash::make( 'vital123' )]);
             User::create(['name' => 'rbowers', 'email' => '*****@*****.**'    , 'password' => Hash::make( 'vital123' )]);
             User::create(['name' => 'pneal'  , 'email' => '*****@*****.**'  , 'password' => Hash::make( 'vital123' )]);
     */
     $roles = Role::whereRaw("name in ('receipt', 'putAwayReserve', 'putAwayPick', 'replen')")->get();
     $users = User::whereRaw("name in ('worker')")->get();
     foreach ($roles as $role) {
         foreach ($users as $user) {
             DB::table('role_user')->insert(['role_id' => $role->id, 'user_id' => $user->id]);
         }
     }
     $roles = Role::whereRaw("name in ('receipt', 'putAwayReserve', 'putAwayPick', 'replen', 'poReconcile', 'teamLead')")->get();
     $users = User::whereRaw("name in ('teamLead')")->get();
     foreach ($roles as $role) {
         foreach ($users as $user) {
             DB::table('role_user')->insert(['role_id' => $role->id, 'user_id' => $user->id]);
         }
     }
     $roles = Role::whereRaw("name in ('receipt', 'putAwayReserve', 'putAwayPick', 'replen', 'poReconcile', 'teamLead', 'super')")->get();
     $users = User::whereRaw("name in ('super')")->get();
     foreach ($roles as $role) {
         foreach ($users as $user) {
             DB::table('role_user')->insert(['role_id' => $role->id, 'user_id' => $user->id]);
         }
     }
     $roles = Role::whereRaw("name in ('receipt', 'putAwayReserve', 'putAwayPick', 'replen', 'poReconcile', 'teamLead', 'super', 'manager')")->get();
     $users = User::whereRaw("name in ('manager', 'rbowers')")->get();
     foreach ($roles as $role) {
         foreach ($users as $user) {
             DB::table('role_user')->insert(['role_id' => $role->id, 'user_id' => $user->id]);
         }
     }
     $roles = Role::whereName('admin')->get();
     $users = User::whereRaw("name in ('admin', 'rbowers')")->get();
     foreach ($roles as $role) {
         foreach ($users as $user) {
             DB::table('role_user')->insert(['role_id' => $role->id, 'user_id' => $user->id]);
         }
     }
     $roles = Role::get();
     $users = User::whereName('pneal')->get();
     foreach ($roles as $role) {
         foreach ($users as $user) {
             DB::table('role_user')->insert(['role_id' => $role->id, 'user_id' => $user->id]);
         }
     }
 }
コード例 #9
0
ファイル: Role.php プロジェクト: lfalmeida/lbase
 /**
  * Mantém a compatibilidade com snake_case ao definir atributos
  *
  * @param string $key
  * @param mixed  $value
  *
  * @return $this|void
  */
 public function setAttribute($key, $value)
 {
     $key = snake_case($key);
     return parent::setAttribute($key, $value);
 }