blumilksoftware / blt

Behat+Laravel toolbox. Still in progress.
https://packagist.org/packages/blumilksoftware/blt
3 stars 0 forks source link

Add recognizeClass helper #41

Closed JakubKermes closed 1 week ago

JakubKermes commented 3 weeks ago

Turn this into universal helper:

   protected function getModelNamespace(): string
    {
        return "App\\Models\\";
    }

    protected function recognizeModelClass(string $model): string
    {
        if (str_contains($model, "\\")) {
            return $model;
        }

        $model = Str::ucfirst(Str::singular($model));
        return $this->getModelNamespace() . $model;
    }