protected function whenPivotLoadedAs($accessor, $table, $value, $default = null)
    {
        if (func_num_args() === 3) {
            $default = new MissingValue;
        }

        return $this->when(
            $this->resource->$accessor &&
            ($this->resource->$accessor instanceof $table ||
            $this->resource->$accessor->getTable() === $table),
            ...[$value, $default]
        );
    }
protected function whenPivotLoadedAs($accessor, $table, $value, $default = null)
    {
        if (func_num_args() === 3) {
            $default = new MissingValue;
        }

        return $this->when(
            $this->resource->$accessor &&
            ($this->resource->$accessor instanceof $table ||
            $this->resource->$accessor->getTable() === $table),
            ...[$value, $default]
        );
    }
protected function whenPivotLoadedAs ( $ accessor , $ table , $ value , $ default = null ) { if ( func_num_args ( ) === 3 ) { $ default = new MissingValue ; } return $ this -> when ( $ this -> resource -> $ accessor && ( $ this -> resource -> $ accessor instanceof $ table || $ this -> resource -> $ accessor -> getTable ( ) === $ table ) , ... [ $ value , $ default ] ) ; }
Execute a callback if the given pivot table with a custom accessor has been loaded.

@param  string  $accessor
@param  string  $table
@param  mixed  $value
@param  mixed  $default
@return \Illuminate\Http\Resources\MissingValue|mixed
Execute a callback if the given pivot table with a custom accessor has been loaded .