The class_basename function returns the class name of the given class with the class's namespace removed:
<?php $class = class_basename('Foo\Bar\Baz');
<?php     protected function build(BlueprintModel $model)

    {

        $this->addImport($model, $this->tree->fqcnForContext($model->name()));

        return sprintf('%s::factory()->count(5)->create();', class_basename($this->tree->fqcnForContext($model->name())));

    }

}
<?php     public function __construct(string $name)

    {

        $this->name = class_basename($name);

        $this->namespace = trim(implode('\\', array_slice(explode('\\', str_replace('/', '\\', $name)), 0, -1)), '\\');

    }
<?php     public function __construct($name)

    {

        $this->name = class_basename($name);

        $this->namespace = trim(implode('\\', array_slice(explode('\\', str_replace('/', '\\', $name)), 0, -1)), '\\');

    }
<?php     public function addPolymorphicManyToManyTable(string $reference)

    {

        $this->polymorphicManyToManyTables[] = class_basename($reference);

    }



    public function addPivotTable(string $reference)
<?php     public function addPivotTable(string $reference)

    {

        $segments = [$this->name(), class_basename($reference)];

        sort($segments);

        $this->pivotTables[] = $segments;

    }