The optional function accepts any argument and allows you to access properties or call methods on that object. If the given object is null, properties and methods will return null instead of causing an error:
<?php return optional($user->address)->street;

{!! old('name', optional($user)->name) !!}
<?php     public function buildRelationFunction(string $column, $relationMethod = null)

    {

        $relationName = optional($relationMethod)->getName() ?? Str::camel(str_replace('_id', '', $column));

        $foreignCallback = '\\App\\REPLACE_THIS::factory()';



        try {