belongsToMany(Plantel::class)->withPivot('plantel_id'); } public function existe($plantelId = null) { if (!$plantelId) { return false; } return $this->planPlantel() ->wherePivot('plantel_id', $plantelId) ->exists(); } public function conceptos(): BelongsToMany { return $this->belongsToMany(Concepto::class) ->orderBy('conceptos.tipo', 'asc') ->orderBy('conceptos.fecha_pago', 'asc'); } }