/** * Create a new many to many relationship instance. * * @param Model $model * @param string $associated * @param string $table * @param string $foreign * @param string $other * @return void */ public function __construct($model, $associated, $table, $foreign, $other) { $this->other = $other; $this->joining = $table ?: $this->joining($model, $associated); // If the Pivot table is timestamped, we'll set the timestamp columns to be // fetched when the pivot table models are fetched by the developer else // the ID will be the only "extra" column fetched in by default. if (Pivot::$timestamps) { $this->with[] = 'created_at'; $this->with[] = 'updated_at'; } parent::__construct($model, $associated, $foreign); }