belongsToMany(Plantel::class)->withPivot('plantel_id'); } public $timestamps = false; public function existe($plantelId = null) { if (!$plantelId) { return false; } return $this->planesPlantel() ->wherePivot('plantel_id', $plantelId) ->exists(); } public function carreraRel() { return $this->belongsTo(Carrera::class, 'carrera'); } public function nivelRel() { return $this->belongsTo(Nivel::class, 'nivel'); } }