Yes, there is a way to disable the cast when accessing a relationship in Laravel. You can achieve this by using the withoutCasts method provided by Eloquent.
Here's an example of how you can eager load a related model using a ENUM casted column without causing an error:
$models = Model::withoutCasts()->with('relatedModel')->get();
In this example, Model is the name of your model class, and relatedModel is the name of the relationship method defined in your model.
By calling the withoutCasts method before eager loading the relationship, you are telling Laravel to temporarily disable the casts for the query. This allows you to retrieve the related model without encountering any casting errors.
Note that this method will only disable the casts for the specific query. The casts will still be applied when accessing the relationship in other parts of your code.
I hope this helps! Let me know if you have any further questions.