title: Laravel Nova BelongsToMany display in resource index
body: <p>I have the following models &amp; nova resources. On my records nova resource I would like to display the first and last name of each athlete attached to the record. I can see the athletes on the detailed page, but I would like them on the resource index page. Is this possible?</p>
  
  <pre><code>namespace App;
  
  class Record extends Model
  {
      use SoftDeletes;
      protected $guarded = ['id'];
  
      public function athletes()
      {
          return $this-&gt;BelongsToMany('App\Athlete');
      }
  }
  
  
  class Athlete extends Model
  {
      use SoftDeletes;
      protected $guarded = ['id'];
  
      public function records()
      {
         return $this-&gt;belongsToMany('App\Record');
      }
  }
  
  class Record extends Resource
  {
      /**
       * The logical group associated with the resource.
       *
       * @var string
       */
          public static $group = 'Records';
  
      /**
       * The model the resource corresponds to.
       *
       * @var string
       */
      public static $model = 'App\Record';
  
      /**
       * The single value that should be used to represent the resource when being displayed.
       *
       * @var string
       */
      public static $title = 'id';
  
      /**
       * The columns that should be searched.
       *
       * @var array
       */
      public static $search = [
          'id','value','notes'
      ];
  
          /**
           * The relationship columns that should be searched.
           *
           * @var array
           */
          public static $searchRelations = [
          'event_school.school' =&gt; ['name'],
          'event_school.event' =&gt; ['name'],
          'athletes' =&gt; ['first_name','last_name'],
          ];
  
  
      /**
       * Get the fields displayed by the resource.
       *
       * @param  \Illuminate\Http\Request  $request
       * @return array
       */
      public function fields(Request $request)
      {
          return [
              ID::make()-&gt;sortable(),
                          BelongsToMany::make('Athletes')-&gt;sortable(),                        
                          BelongsTo::make('School Event','event_school','App\Nova\EventSchool')-&gt;sortable()-&gt;searchable(),
                          Boolean::make('Archived')-&gt;sortable(),
                          Text::make('Value')-&gt;sortable(),
                          Select::make('Value Type')-&gt;options([
                              'time' =&gt; 'Time',
                              'distance' =&gt; 'Distance',
                          ])-&gt;sortable(),
                          Select::make('Display Measurement')-&gt;options([
                              'metric' =&gt; 'Metric',
                              'imperial' =&gt; 'Imperial',
                          ])-&gt;sortable(),
  
                          Text::make('Year')-&gt;sortable(),
                          Text::make('Place')-&gt;sortable(),
                          Text::make('Notes')-&gt;sortable(),
  
                          BelongsToMany::make('Attributes')-&gt;fields(function() {
                      return [
                          Text::make('Value'),
                                  Select::make('Value Type')-&gt;options([
                                      'time' =&gt; 'Time',
                                      'distance' =&gt; 'Distance',
                                  ])-&gt;sortable(),
                                  Select::make('Display Measurement')-&gt;options([
                                      'metric' =&gt; 'Metric',
                                      'imperial' =&gt; 'Imperial',
                                  ])-&gt;sortable()
                      ];
                      })                      
          ];
      }
  }
  
  
  class Athlete extends Resource
  {
      /**
       * The logical group associated with the resource.
       *
       * @var string
       */
          public static $group = 'Records';
  
      /**
       * The model the resource corresponds to.
       *
       * @var string
       */
      public static $model = 'App\Athlete';
  
      /**
       * The single value that should be used to represent the resource when being displayed.
       *
       * @var string
       */
      public static $title = 'first_name';
  
      /**
       * The columns that should be searched.
       *
       * @var array
       */
      public static $search = [
          'id','first_name','last_name'
      ];
  
          /**
           * The relationship columns that should be searched.
           *
           * @var array
           */
          public static $searchRelations = [
              'school' =&gt; ['name'],
          ];
  
      /**
       * Get the fields displayed by the resource.
       *
       * @param  \Illuminate\Http\Request  $request
       * @return array
       */
      public function fields(Request $request)
      {
          return [
              ID::make()-&gt;sortable(),
                          BelongsTo::make('School'),
                          BelongsToMany::make('Records'),
                Text::make('First Name')
                    -&gt;sortable()
                    -&gt;rules('required', 'max:255'),
                Text::make('Last Name')
                    -&gt;sortable()
                    -&gt;rules('required', 'max:255'),
  
          ];
      }
  </code></pre>