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(); } }