We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 5 | trait Search |
||
| 6 | { |
||
| 7 | /* |
||
| 8 | |-------------------------------------------------------------------------- |
||
| 9 | | SEARCH |
||
| 10 | |-------------------------------------------------------------------------- |
||
| 11 | */ |
||
| 12 | |||
| 13 | public $ajax_table = true; |
||
| 14 | public $responsive_table; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Add conditions to the CRUD query for a particular search term. |
||
| 18 | * |
||
| 19 | * @param [string] $searchTerm Whatever string the user types in the search bar. |
||
|
|
|||
| 20 | */ |
||
| 21 | public function applySearchTerm($searchTerm) |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Apply the search logic for each CRUD column. |
||
| 36 | */ |
||
| 37 | public function applySearchLogicForColumn($query, $column, $searchTerm) |
||
| 84 | |||
| 85 | /** |
||
| 86 | * Tell the list view to use AJAX for loading multiple rows. |
||
| 87 | * |
||
| 88 | * @deprecated 3.3.0 All tables are AjaxTables starting with 3.3.0. |
||
| 89 | */ |
||
| 90 | public function enableAjaxTable() |
||
| 94 | |||
| 95 | /** |
||
| 96 | * Check if ajax is enabled for the table view. |
||
| 97 | * |
||
| 98 | * @deprecated 3.3.0 Since all tables use ajax, this will soon be removed. |
||
| 99 | * @return bool |
||
| 100 | */ |
||
| 101 | public function ajaxTable() |
||
| 105 | |||
| 106 | /** |
||
| 107 | * Tell the list view to NOT show a reponsive DataTable. |
||
| 108 | * @param bool $value |
||
| 109 | */ |
||
| 110 | public function setResponsiveTable($value = true) |
||
| 114 | |||
| 115 | /** |
||
| 116 | * Check if responsiveness is enabled for the table view. |
||
| 117 | * |
||
| 118 | * @return bool |
||
| 119 | */ |
||
| 120 | public function getResponsiveTable() |
||
| 121 | { |
||
| 122 | if ($this->responsive_table !== null) { |
||
| 123 | return $this->responsive_table; |
||
| 124 | } |
||
| 125 | |||
| 126 | return config('backpack.crud.responsive_table'); |
||
| 127 | } |
||
| 128 | |||
| 129 | /** |
||
| 130 | * Remember to show a responsive table. |
||
| 131 | */ |
||
| 132 | public function enableResponsiveTable() |
||
| 133 | { |
||
| 134 | $this->setResponsiveTable(true); |
||
| 135 | } |
||
| 136 | |||
| 137 | /** |
||
| 138 | * Remember to show a table with horizontal scrolling. |
||
| 139 | */ |
||
| 140 | public function disableResponsiveTable() |
||
| 141 | { |
||
| 142 | $this->setResponsiveTable(false); |
||
| 143 | } |
||
| 144 | |||
| 145 | /** |
||
| 146 | * Get the HTML of the cells in a table row, for a certain DB entry. |
||
| 147 | * @param Entity $entry A db entry of the current entity; |
||
| 148 | * @param int The number shown to the user as row number (index); |
||
| 149 | * @return array Array of HTML cell contents. |
||
| 150 | */ |
||
| 151 | public function getRowViews($entry, $rowNumber = false) |
||
| 152 | { |
||
| 153 | $row_items = []; |
||
| 154 | |||
| 155 | foreach ($this->columns as $key => $column) { |
||
| 156 | $row_items[] = $this->getCellView($column, $entry, $rowNumber); |
||
| 157 | } |
||
| 158 | |||
| 159 | // add the buttons as the last column |
||
| 160 | if ($this->buttons->where('stack', 'line')->count()) { |
||
| 161 | $row_items[] = \View::make('crud::inc.button_stack', ['stack' => 'line']) |
||
| 162 | ->with('crud', $this) |
||
| 163 | ->with('entry', $entry) |
||
| 164 | ->with('row_number', $rowNumber) |
||
| 165 | ->render(); |
||
| 166 | } |
||
| 167 | |||
| 168 | // add the details_row button to the first column |
||
| 169 | if ($this->details_row) { |
||
| 170 | $details_row_button = \View::make('crud::columns.details_row_button') |
||
| 171 | ->with('crud', $this) |
||
| 172 | ->with('entry', $entry) |
||
| 173 | ->with('row_number', $rowNumber) |
||
| 174 | ->render(); |
||
| 175 | $row_items[0] = $details_row_button.$row_items[0]; |
||
| 176 | } |
||
| 177 | |||
| 178 | return $row_items; |
||
| 179 | } |
||
| 180 | |||
| 181 | /** |
||
| 182 | * Get the HTML of a cell, using the column types. |
||
| 183 | * @param array $column |
||
| 184 | * @param Entity $entry A db entry of the current entity; |
||
| 185 | * @param int The number shown to the user as row number (index); |
||
| 186 | * @return HTML |
||
| 187 | */ |
||
| 188 | public function getCellView($column, $entry, $rowNumber = false) |
||
| 192 | |||
| 193 | /** |
||
| 194 | * Get the name of the view to load for the cell. |
||
| 195 | * @param $column |
||
| 196 | * @return string |
||
| 197 | */ |
||
| 198 | private function getCellViewName($column) |
||
| 218 | |||
| 219 | /** |
||
| 220 | * Render the given view. |
||
| 221 | * @param $view |
||
| 222 | * @param $column |
||
| 223 | * @param $entry |
||
| 224 | * @param int The number shown to the user as row number (index); |
||
| 225 | * @return mixed |
||
| 226 | */ |
||
| 227 | private function renderCellView($view, $column, $entry, $rowNumber = false) |
||
| 240 | |||
| 241 | /** |
||
| 242 | * Created the array to be fed to the data table. |
||
| 243 | * |
||
| 244 | * @param $entries Eloquent results. |
||
| 245 | * @return array |
||
| 246 | */ |
||
| 247 | public function getEntriesAsJsonForDatatables($entries, $totalRows, $filteredRows, $startIndex = false) |
||
| 262 | } |
||
| 263 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.