Coder Social home page Coder Social logo

Base name as class shortcut about tinx HOT 5 CLOSED

furey avatar furey commented on May 17, 2024
Base name as class shortcut

from tinx.

Comments (5)

ajthinking avatar ajthinking commented on May 17, 2024

Possibly there will be a conflict as Laravel Tinker now ships with functionality from laravel-tinker-tools. This functionallity autoloads Car class and aliases it to 'Car'.

from tinx.

furey avatar furey commented on May 17, 2024

Hi @kolmogorov42,

I've just pushed a new patch release (v2.0.7) that should resolve your issue.

Once updated, please check your strategy config value is correctly set to your custom naming strategy's fully qualified class name…

<?php

// 'config/tinx.php'

return [

    // etc…

    /**
     * Model shortcut naming strategy (e.g. 'App\User' = '$u', '$u_', 'u()').
     * Supported values: 'pascal', 'shortestUnique'
     * */
    // 'strategy' => 'pascal',
    /**
     * Alternatively, you may pass a resolvable fully qualified class name
     * implementing 'Ajthinking\Tinx\Naming\Strategy'.
     * */
    'strategy' => App\CustomNamingStrategy::class,

    // etc…

];

…and you should be good to go. 👍

As an aside, Tinx's Ajthinking\Tinx\Models\Model class already defines a shortClassName property (also, shortClassNameSlug), so you could use that in your strategy getNames() method instead of class_basename if you so desire.

Cheers.

from tinx.

furey avatar furey commented on May 17, 2024

Hi @kolmogorov42,

Have you had a chance to look at my previous reply?

#43 (comment)

Fingers crossed that sorts your issue out. 🤞

Cheers.

from tinx.

kolmogorov42 avatar kolmogorov42 commented on May 17, 2024

Sorry, not yet!
I tried it briefly just after your previous reply, and it didn't work. But I guess that might be because I've been messing with the configuration a lot, so don't quote me on that.
I should try again on a fresh Laravel project.
I'll bring news when I can test it: in the meantime, good job and thank you 👍

from tinx.

furey avatar furey commented on May 17, 2024

Hi @kolmogorov42,

No worries! I'll close this issue for now – if pain persists, please open a new one.

Have a great day!

🤓✌️

from tinx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.