Overview

Namespaces

  • rsanchez
    • Deep
      • App
        • EE
        • Laravel
          • Facade
      • Collection
      • Hydrator
      • Model
      • Plugin
      • Relations
      • Repository

Classes

  • AbstractFieldCollection
  • AbstractTitleCollection
  • AssetCollection
  • CategoryCollection
  • CategoryFieldCollection
  • ChannelCollection
  • EntryCollection
  • FieldCollection
  • FileCollection
  • GridColCollection
  • GridRowCollection
  • MatrixColCollection
  • MatrixRowCollection
  • MemberFieldCollection
  • PlayaCollection
  • RelationshipCollection
  • SiteCollection
  • TitleCollection
  • UploadPrefCollection

Interfaces

  • FilterableInterface

Traits

  • FilterableTrait
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: /**
  4:  * Deep
  5:  *
  6:  * @package      rsanchez\Deep
  7:  * @author       Rob Sanchez <info@robsanchez.com>
  8:  */
  9: 
 10: namespace rsanchez\Deep\Collection;
 11: 
 12: /**
 13:  * {@inheritdoc}
 14:  *
 15:  * A model collection that is sortable and filterable by common parameters
 16:  */
 17: interface FilterableInterface
 18: {
 19:     /**
 20:      * Create a copy of this Collection
 21:      * @return \Illuminate\Database\Eloquent\Collection
 22:      */
 23:     public function createClone();
 24: 
 25:     /**
 26:      * Filter by model attribute contains
 27:      *
 28:      * @param  string                                   $attribute name of the attribute on which to filter
 29:      * @param  array                                    $values
 30:      * @param  bool                                     $and
 31:      * @param  bool                                     $not
 32:      * @return \Illuminate\Database\Eloquent\Collection
 33:      */
 34:     public function filterByAttributeContains($attribute, array $values, $and = false, $not = false);
 35: 
 36:     /**
 37:      * Filter by model attribute in array string
 38:      *
 39:      * @param  string                                   $attribute name of the attribute on which to filter
 40:      * @param  string                                   $filter    pipe-delimited list of values, optionaly prefixed by not
 41:      * @return \Illuminate\Database\Eloquent\Collection
 42:      */
 43:     public function filterByAttributeInString($attribute, $filter);
 44: 
 45:     /**
 46:      * Filter by model attribute in array
 47:      *
 48:      * @param  string                                   $attribute name of the attribute on which to filter
 49:      * @param  array                                    $values
 50:      * @param  bool                                     $not
 51:      * @return \Illuminate\Database\Eloquent\Collection
 52:      */
 53:     public function filterByAttributeIn($attribute, array $values, $not = false);
 54: 
 55:     /**
 56:      * Filter by model attribute numerical comparison
 57:      *
 58:      * @param  string                                   $attribute name of the attribute on which to filter
 59:      * @param  mixed                                    $value
 60:      * @param  string                                   $operator  >, >=, <, <=
 61:      * @return \Illuminate\Database\Eloquent\Collection
 62:      */
 63:     public function filterByAttributeComparison($attribute, $value, $operator);
 64: 
 65:     /**
 66:      * Filter by model attribute
 67:      *
 68:      * The filter should be one of the following formats:
 69:      * - 'foo|bar'
 70:      * - 'not foo|bar'
 71:      * - '=foo|bar'
 72:      * - '=not foo|bar'
 73:      * - 'foo&&bar'
 74:      * - 'not foo|bar'
 75:      * - 'foo\W|bar'
 76:      * - '>=3'
 77:      *
 78:      * @param  string                                   $attribute name of the attribute on which to filter
 79:      * @param  string                                   $filter    a string describing the filter
 80:      * @return \Illuminate\Database\Eloquent\Collection
 81:      */
 82:     public function filterByAttribute($attribute, $filter);
 83: 
 84:     /**
 85:      * Filter by model ID
 86:      *
 87:      * @param  int                                      $id,... one or more IDs
 88:      * @return \Illuminate\Database\Eloquent\Collection
 89:      */
 90:     public function filterById($id);
 91: 
 92:     /**
 93:      * Limit the collection
 94:      *
 95:      * @param  int                                      $limit
 96:      * @param  int                                      $offset
 97:      * @return \Illuminate\Database\Eloquent\Collection
 98:      */
 99:     public function limit($limit, $offset = 0);
100: 
101:     /**
102:      * Offset the collection
103:      *
104:      * @param  int                                      $limit
105:      * @param  int                                      $offset
106:      * @return \Illuminate\Database\Eloquent\Collection
107:      */
108:     public function offset($offset, $limit = null);
109: 
110:     /**
111:      * Sort by one or more model attributes
112:      *
113:      * @param  array|int                                $id   one or more IDs
114:      * @param  array|string                             $sort sort direction
115:      * @return \Illuminate\Database\Eloquent\Collection
116:      */
117:     public function sortByAttribute($attribute, $sort = 'asc');
118: 
119:     /**
120:      * Sort by model ID in the specified order
121:      *
122:      * @param  int                                      $id,... one or more IDs
123:      * @return \Illuminate\Database\Eloquent\Collection
124:      */
125:     public function sortByFixedOrder($id);
126: 
127:     /**
128:      * Sort and filter a clone of this collection according to the given array of params.
129:      *
130:      * The array may contain the following:
131:      * - limit
132:      * - offset
133:      * - search:your_field
134:      * - fixed_order
135:      * - orderby
136:      * - sort
137:      * - any model attribute (ex. row_id)
138:      *
139:      * @param  array                                    $params
140:      * @return \Illuminate\Database\Eloquent\Collection
141:      */
142:     public function tagparams(array $params);
143: 
144:     /**
145:      * Alias to tagparams
146:      *
147:      * @param  array                                    $params
148:      * @return \Illuminate\Database\Eloquent\Collection
149:      */
150:     public function __invoke(array $params);
151: }
152: 
API documentation generated by ApiGen 2.8.0