Xpressengine\Permission\Permission::getAttributes PHP Method

getAttributes() public method

returns current attributes
public getAttributes ( ) : array
return array
    public function getAttributes()
    {
        $this->attributes['grants'] = json_encode($this->grant->getAttributes());
        return $this->attributes;
    }

Usage Example

 /**
  * Insert register information
  *
  * @param Permission $item permission instance
  *
  * @return Permission
  */
 public function insert(Permission $item)
 {
     $now = $this->getNow();
     $dates = ['createdAt' => $now, 'updatedAt' => $now];
     $id = $this->conn->table($this->table)->insertGetId(array_merge($item->getAttributes(), $dates));
     return $this->createItem(array_merge($item->getAttributes(), ['id' => $id], $dates));
 }