Пример #1
0
 /**
  * @param       $query
  * @param       $field
  * @param array $patterns
  * @return mixed
  */
 public static function handleSearchQuery($query, $field, array $patterns)
 {
     if (in_array($field, ['title', 'book', 'name'])) {
         return parent::handleSearchQuery($query, $field, $patterns);
     } else {
         return $query;
     }
 }
Пример #2
0
 /**
  * @param StoredImageContract $image
  * @param BaseModel           $instance
  * @param string              $type
  * @param int                 $order
  * @return ImageModel
  */
 public static function insertImage(StoredImageContract $image, BaseModel $instance, $type = 'default', $order = 0)
 {
     $one = static::create(array('imageable_type' => $instance->getMorphClass(), 'imageable_id' => $instance->getKey(), 'type' => $type, 'order' => $order));
     $one->updateImageRecord($image)->save();
     return $one;
 }
Пример #3
0
 /**
  * @param BaseModel $model
  * @return mixed
  */
 public static function dump(BaseModel $model)
 {
     $blueprint = new FormBluePrint();
     $blueprint = $model->_schema($blueprint);
     return $blueprint->dump();
 }