After so many attempts and searching the source of the Laravel Model , I finally got it.
Please put the following method in your model.
public function toArray() { $attributes = $this->attributesToArray(); $attributes = array_merge($attributes, $this->relationsToArray()); unset($attributes['pivot']['created_at']); return $attributes; }
This solves the goal.
source share