src/Traits/WorksWithRelations.php
private function _checkRelationExists(Model $model, string $relationName)
    {
        if (!method_exists($model, $relationName) || !$model->{$relationName}() instanceof Relation) {
            if (Lang::has('resource-controller.data2relationinexistent')) {
                $message = trans('resource-controller.data2relationinexistent', ['relationName' => $relationName]);
            } else {
                $message = "Array type request data '{$relationName}' must be named after an existent relation.";
            }

            throw new MassAssignmentException($message);
        }
    }
private function _checkRelationExists(Model $model, string $relationName)
    {
        if (!method_exists($model, $relationName) || !$model->{$relationName}() instanceof Relation) {
            if (Lang::has('resource-controller.data2relationinexistent')) {
                $message = trans('resource-controller.data2relationinexistent', ['relationName' => $relationName]);
            } else {
                $message = "Array type request data '{$relationName}' must be named after an existent relation.";
            }

            throw new MassAssignmentException($message);
        }
    }
private function _checkRelationExists ( Model $ model , string $ relationName ) { if ( ! method_exists ( $ model , $ relationName ) || ! $ model -> { $ relationName } ( ) instanceof Relation ) { if ( Lang :: has ( 'resource-controller.data2relationinexistent' ) ) { $ message = trans ( 'resource-controller.data2relationinexistent' , [ 'relationName' => $ relationName ] ) ; } else { $ message = "Array type request data '{$relationName}' must be named after an existent relation." ; } throw new MassAssignmentException ( $ message ) ; } }
Throw an exception if array type request data is not named after an existent Eloquent relation.

@param Model  $model        The eloquent model.
@param string $relationName The eloquent relation name.

@throws MassAssignmentException

@return void
Throw an exception if array type request data is not named after an existent Eloquent relation .