isFillable() public method

Determine if the given attribute may be mass assigned.
public isFillable ( string $key ) : boolean
$key string
return boolean
コード例 #1
0
 /**
  * Flush the cache for this Model Object instance
  *
  * @param Model $model
  * @return void
  */
 public function flush(Model $model)
 {
     // Assemble Cache Keys
     $keys[] = $this->resourceName . '.hash.' . $model->hash;
     $keys[] = $this->resourceName . '.id.' . $model->id;
     // Some keys will not be available on all models
     if ($this->model->isFillable('ref')) {
         $keys[] = $this->resourceName . '.ref.' . $model->ref;
     }
     // Clear the cache for the given keys
     foreach ($keys as $key) {
         $this->cache->forget($key);
     }
 }
コード例 #2
0
ファイル: BaseRepository.php プロジェクト: srlabs/groundwork
 /**
  * Flush the cache for this Model Object instance
  *
  * @param Model $model
  * @return void
  */
 public function flush(Model $model)
 {
     // Assemble Cache Keys
     $keys[] = $this->resourceName . '.hash.' . $model->hash;
     $keys[] = $this->resourceName . '.id.' . $model->id;
     // Some keys will not be available on all models
     $referenceColumn = $this->referenceIdColumnName();
     if ($this->model->isFillable($referenceColumn)) {
         $keys[] = $this->resourceName . '.' . $referenceColumn . '.' . $model->{$referenceColumn};
     }
     // Clear the cache for the given keys
     foreach ($keys as $key) {
         $this->cache->forget($key);
     }
 }
コード例 #3
0
ファイル: Node.php プロジェクト: NuclearCMS/Hierarchy
 /**
  * Determine if the given attribute may be mass assigned.
  * (This method is an extension to the base Model isFillable method.
  * It includes the node source attributes in order to check if keys are fillable.)
  *
  * @param  string $key
  * @return bool
  */
 public function isFillable($key)
 {
     // We can assume source attributes are fillable
     return $this->isSourceAttribute($key) || parent::isFillable($key);
 }
コード例 #4
0
 /**
  * POST and PUT requests must contain all attributes.
  * This method returns all fillable attributes which are missing.
  *
  * @param Model $model
  * @return array
  */
 protected function getMissingUpdateAttributes(Model $model)
 {
     $keys = array_keys($this->body->getArray());
     $columnNames = $this->schemaBuilder->getColumnListing($model->getTable());
     $attributes = [];
     foreach ($columnNames as $column) {
         if ($model->isFillable($column) && !in_array($column, $keys)) {
             $attributes[] = $column;
         }
     }
     return $attributes;
 }