original_string: protected function getOptionsFromModel($scope, $searchQuery = null)
      {
          $model = $this->scopeModels[$scope->scopeName];
  
          $query = $model->newQuery();
  
          /*
           * The 'group' scope has trouble supporting more than 500 records at a time
           * @todo Introduce a more advanced version with robust list support.
           */
          $query->limit(500);
  
          /**
           * @event backend.filter.extendQuery
           * Provides an opportunity to extend the query of the list of options
           *
           * Example usage:
           *
           *     Event::listen('backend.filter.extendQuery', function((\Backend\Widgets\Filter) $filterWidget, $query, (\Backend\Classes\FilterScope) $scope) {
           *         if ($scope->scopeName == 'status') {
           *             $query->where('status', '<>', 'all');
           *         }
           *     });
           *
           * Or
           *
           *     $listWidget->bindEvent('filter.extendQuery', function ($query, (\Backend\Classes\FilterScope) $scope) {
           *         if ($scope->scopeName == 'status') {
           *             $query->where('status', '<>', 'all');
           *         }
           *     });
           *
           */
          $this->fireSystemEvent('backend.filter.extendQuery', [$query, $scope]);
  
          if (!$searchQuery) {
              return $query->get();
          }
  
          $searchFields = [$model->getKeyName(), $this->getScopeNameFrom($scope)];
          return $query->searchWhere($searchQuery, $searchFields)->get();
      }
code: protected function getOptionsFromModel($scope, $searchQuery = null)
      {
          $model = $this->scopeModels[$scope->scopeName];
  
          $query = $model->newQuery();
  
          /*
           * The 'group' scope has trouble supporting more than 500 records at a time
           * @todo Introduce a more advanced version with robust list support.
           */
          $query->limit(500);
  
          /**
           * @event backend.filter.extendQuery
           * Provides an opportunity to extend the query of the list of options
           *
           * Example usage:
           *
           *     Event::listen('backend.filter.extendQuery', function((\Backend\Widgets\Filter) $filterWidget, $query, (\Backend\Classes\FilterScope) $scope) {
           *         if ($scope->scopeName == 'status') {
           *             $query->where('status', '<>', 'all');
           *         }
           *     });
           *
           * Or
           *
           *     $listWidget->bindEvent('filter.extendQuery', function ($query, (\Backend\Classes\FilterScope) $scope) {
           *         if ($scope->scopeName == 'status') {
           *             $query->where('status', '<>', 'all');
           *         }
           *     });
           *
           */
          $this->fireSystemEvent('backend.filter.extendQuery', [$query, $scope]);
  
          if (!$searchQuery) {
              return $query->get();
          }
  
          $searchFields = [$model->getKeyName(), $this->getScopeNameFrom($scope)];
          return $query->searchWhere($searchQuery, $searchFields)->get();
      }
code_tokens: protected function getOptionsFromModel ( $ scope , $ searchQuery = null ) { $ model = $ this -> scopeModels [ $ scope -> scopeName ] ; $ query = $ model -> newQuery ( ) ; /*
           * The 'group' scope has trouble supporting more than 500 records at a time
           * @todo Introduce a more advanced version with robust list support.
           */ $ query -> limit ( 500 ) ; /**
           * @event backend.filter.extendQuery
           * Provides an opportunity to extend the query of the list of options
           *
           * Example usage:
           *
           *     Event::listen('backend.filter.extendQuery', function((\Backend\Widgets\Filter) $filterWidget, $query, (\Backend\Classes\FilterScope) $scope) {
           *         if ($scope->scopeName == 'status') {
           *             $query->where('status', '<>', 'all');
           *         }
           *     });
           *
           * Or
           *
           *     $listWidget->bindEvent('filter.extendQuery', function ($query, (\Backend\Classes\FilterScope) $scope) {
           *         if ($scope->scopeName == 'status') {
           *             $query->where('status', '<>', 'all');
           *         }
           *     });
           *
           */ $ this -> fireSystemEvent ( 'backend.filter.extendQuery' , [ $ query , $ scope ] ) ; if ( ! $ searchQuery ) { return $ query -> get ( ) ; } $ searchFields = [ $ model -> getKeyName ( ) , $ this -> getScopeNameFrom ( $ scope ) ] ; return $ query -> searchWhere ( $ searchQuery , $ searchFields ) -> get ( ) ; }
docstring: Looks at the model for defined scope items.
  @return Collection
docstring_tokens: Looks at the model for defined scope items .