title: Laravel Eloquent relationship keyBy()
body: <p>i want to modify the result set of relationship in the following way</p>
  
  <p>I have this array</p>
  
  <pre>
  
      array:11 [▼
        "id" => 1
        "user_id" => 1
        "name" => "Test Case"
        "created_at" => "2017-08-25 17:12:26"
        "updated_at" => "2017-08-29 11:59:46"
        "hashid" => "5LOkAdWNDqgVomK"
        "user" => array:8 [▶]
        "order" => array:8 [▶]
        "classification" => array:2 [▼
          0 => array:9 [▼
            "id" => 1
            "case_id" => 1
            "method" => "facial_map_manual"
            "strong" => 2.0
            "dynamic" => 30.0
            "delicate" => 50.0
            "calm" => 18.0
            "created_at" => "2017-08-31 11:00:00"
            "updated_at" => "2017-08-31 11:00:00"
          ]
          1 => array:9 [▼
            "id" => 2
            "case_id" => 1
            "method" => "interview"
            "strong" => 20.0
            "dynamic" => 25.0
            "delicate" => 30.0
            "calm" => 25.0
            "created_at" => "2017-08-31 11:00:00"
            "updated_at" => "2017-08-31 11:00:00"
          ]
        ]
        "classification_data" => array:3 [▼
          0 => array:6 [▼
            "id" => 1
            "case_id" => 1
            "type" => "facial_points"
            "data" => null
            "created_at" => "2017-08-31 11:00:00"
            "updated_at" => "2017-08-31 11:00:00"
          ]
          1 => array:6 [▼
            "id" => 2
            "case_id" => 1
            "type" => "interview"
            "data" => array:4 [▶]
            "created_at" => "2017-08-31 12:00:00"
            "updated_at" => "2017-08-31 11:00:00"
          ]
          2 => array:6 [▶]
        ]
        "teeth_configuration" => array:6 [▶]
      ]
  
  </pre>
  
  <p>I want to map <b>classification</b> and <b>classification_data</b> by column key ( type OR method ) which are loaded relationships. 
  This is the query:</p>
  
  <pre><code> $case = RCase::with(['user','order','classification','classificationData','teethConfiguration'])-&gt;where('id',$id)
                      -&gt;first();
  </code></pre>
  
  <p>This is what i tried so far</p>
  
  <pre><code>$case-&gt;classificationData =  $case-&gt;classificationData-&gt;keyBy('type')-&gt;toArray();
  </code></pre>
  
  <p>With the first method they are ordered by type but the old <b>classification_data</b> stays there even if try to <pre> unlink($case->classification_data) </pre>
  This is not the big problem... I can do this also with <b>classification</b> but the data stays the same.</p>
  
  <p><strong>Is there any method with which i can do keyBy() straight in the loaded relation model ?</strong> Thanks in advance</p>
  
  <pre>
  PHP Version: 7.1
  Laravel Version: 5.4.38
  OS: Ubuntu 16.04 LTS
  </pre>