Example #1
0
 public function register(Model $model, $field)
 {
     $name = $model->getName();
 }
Example #2
0
 /**
  * Make a selection based on request.
  * @param Model $model The model.
  * @param string|null $ids Optional comma-separated list of ids to select.
  * @param string $idField Name of id field.
  * @return self Self.
  */
 public function makeSelection(Model $model, $ids = null, $idField = 'id')
 {
     $this->modelName = $model->getName();
     $this->record = null;
     $this->selection = null;
     if (isset($ids)) {
         $ids = explode(',', $ids);
         $type = $model->getType($idField);
         if (count($ids) == 1) {
             $this->record = $model->where('%c = %_', $idField, $type, $ids[0])->first();
         } else {
             if (count($ids) > 1) {
                 $this->selection = $model->where('%c IN %_()', $idField, $type, $ids);
             }
         }
     } else {
         if (isset($this->request->query['filter'])) {
             $this->selection = $this->Filtering->apply($model);
         }
     }
     return $this;
 }