protected function getPermission()
    {
        // Get the display name.  This will go in the 'label' field.
        $label = ucwords($this->ask('Specify the display name for a new permission'));

        $name = null;

        // Make sure we get a valid key name for the permission.
        while (is_null($name)) {
            $name = $this->ask('What should the key name be set to?', Str::slug($label));

            // Make sure they approve the details for the new permission.
            if ($this->confirm("Your permission will be added as: \n\tLabel: $label \n\tName:  $name\nSave this permission?", true)) {
                $data = [
                    'name'       => $name,
                    'label'      => $label,
                    'created_at' => date('Y-m-d H:i:s'),
                ];

                // Add it to the database or detail an error has occurred and a new name needs to be supplied.
                try {
                    $this->db->table('rbac_permissions')->insert($data);
                } catch (QueryException $exception) {
                    $this->error('That name is already taken.  Please choose another.');

                    $name = null;
                    continue;
                }

                // Add the permission to our list.
                $this->permissions[] = (object)$data;

                $this->comment('Added!');
            } else {
                return true;
            }
        }

        // Allow them the chance to add another one.
        return $this->confirm('Add another permission?', true);
    }
protected function getPermission()
    {
        // Get the display name.  This will go in the 'label' field.
        $label = ucwords($this->ask('Specify the display name for a new permission'));

        $name = null;

        // Make sure we get a valid key name for the permission.
        while (is_null($name)) {
            $name = $this->ask('What should the key name be set to?', Str::slug($label));

            // Make sure they approve the details for the new permission.
            if ($this->confirm("Your permission will be added as: \n\tLabel: $label \n\tName:  $name\nSave this permission?", true)) {
                $data = [
                    'name'       => $name,
                    'label'      => $label,
                    'created_at' => date('Y-m-d H:i:s'),
                ];

                // Add it to the database or detail an error has occurred and a new name needs to be supplied.
                try {
                    $this->db->table('rbac_permissions')->insert($data);
                } catch (QueryException $exception) {
                    $this->error('That name is already taken.  Please choose another.');

                    $name = null;
                    continue;
                }

                // Add the permission to our list.
                $this->permissions[] = (object)$data;

                $this->comment('Added!');
            } else {
                return true;
            }
        }

        // Allow them the chance to add another one.
        return $this->confirm('Add another permission?', true);
    }
protected function getPermission ( ) { // Get the display name.  This will go in the 'label' field. $ label = ucwords ( $ this -> ask ( 'Specify the display name for a new permission' ) ) ; $ name = null ; // Make sure we get a valid key name for the permission. while ( is_null ( $ name ) ) { $ name = $ this -> ask ( 'What should the key name be set to?' , Str :: slug ( $ label ) ) ; // Make sure they approve the details for the new permission. if ( $ this -> confirm ( "Your permission will be added as: \n\tLabel: $label \n\tName:  $name\nSave this permission?" , true ) ) { $ data = [ 'name' => $ name , 'label' => $ label , 'created_at' => date ( 'Y-m-d H:i:s' ) , ] ; // Add it to the database or detail an error has occurred and a new name needs to be supplied. try { $ this -> db -> table ( 'rbac_permissions' ) -> insert ( $ data ) ; } catch ( QueryException $ exception ) { $ this -> error ( 'That name is already taken.  Please choose another.' ) ; $ name = null ; continue ; } // Add the permission to our list. $ this -> permissions [ ] = ( object ) $ data ; $ this -> comment ( 'Added!' ) ; } else { return true ; } } // Allow them the chance to add another one. return $ this -> confirm ( 'Add another permission?' , true ) ; }
Allow the user to specify any number of permissions to add to the database.

@return bool
Allow the user to specify any number of permissions to add to the database .