MatisseComponents/Models/File.php
public function scopeOfField ($query, $fieldName)
  {
    $fieldName = str_segmentsLast ($fieldName, '.');
    return exists ($fieldName) ? $query->where ('group', $fieldName) : $query;
  }
public function scopeOfField ($query, $fieldName)
  {
    $fieldName = str_segmentsLast ($fieldName, '.');
    return exists ($fieldName) ? $query->where ('group', $fieldName) : $query;
  }
public function scopeOfField ( $ query , $ fieldName ) { $ fieldName = str_segmentsLast ( $ fieldName , '.' ) ; return exists ( $ fieldName ) ? $ query -> where ( 'group' , $ fieldName ) : $ query ; }
A query scope that restricts results to files bound to a specific field on the owner model.

@param Builder $query
@param string  $fieldName
@return mixed
A query scope that restricts results to files bound to a specific field on the owner model .