code: public function getPivotFields($obj, $prop)
      {
          $reflection = new \ReflectionClass($obj);
          $property = $reflection->getProperty($prop);
          $property->setAccessible(true);
          $value = $property->getValue($obj);
          $property->setAccessible(false);
          
          /* Remove timestamp from pivot */
          return array_diff($value, [
              'deleted_at',
              'created_at',
              'updated_at'
          ]);
      }
docs: Get array fields fillable from Pivot Relation
  
  @return array