GithubHelp home page GithubHelp logo

Comments (4)

ash-jc-allen avatar ash-jc-allen commented on August 16, 2024

Hi @paoloveggi,

Sorry to hear that you're having issues.

If I understand your problem right, it seems like everything is working as intended.

If we look at this example and assume that our app's URL is https://webapp.com:

$shortUrl = $builder->destinationUrl('https://destination.com')->urlKey('custom-key')->make();

By using the above code, you'd create a new ShortURL in the database that had the default_short_url as https://webapp.com/short/custom-key. The default short URL is only intended as the default URL if you are using the controller and route together that come with the package.

If you then wanted to use your route structure, you should be able to go to this URL:

 https://webapp.com/s/custom-key

I've just tested this locally and it seems to work as expected. Please let me know if you're still having issues and try to provide some screenshots, code examples or stack traces so I can try and help out a bit more 😄

from short-url.

paoloveggi avatar paoloveggi commented on August 16, 2024

Hello,

ok I understood. In my opinion it would be better if in database you store the real shortURL generated by the make() function, anyway it works and I checked the visited links table and it's ok as well.

Nice work,
thank you.

from short-url.

moljac024 avatar moljac024 commented on August 16, 2024

This sounds broken to me. What good is the default_short_url column? How about we make it instead a short_url column and ask users for a callback function that will generate it given a custom-key ?

The callback could be optional and the default one would just generate urls the way it currently does.

from short-url.

ash-jc-allen avatar ash-jc-allen commented on August 16, 2024

@moljac024 This is 100% the intended behaviour and is working as expected. When you generate the short URL, it will populate the default_short_url so that you can quickly grab the link for the model if you're using the default route and controller provided by the package.

If you're not using the default route and controller, there isn't currently a way to store any custom URLs on the model. If you have any ideas about how you might be able to improve or add to the library, I'd be happy to look at any pull requests.

from short-url.

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.