Giter VIP home page Giter VIP logo

Comments (7)

arcanedev-maroc avatar arcanedev-maroc commented on June 8, 2024

The Route::resource() is not in Localization package scope.

As you can see there is no Route::transResource, and the routes.users is not going to be translated.

Try to be explicit with your routes and use the transGet, transPost, transDelete ... methods, that will fix your problem.

Check : #9

from localization.

ppalella avatar ppalella commented on June 8, 2024

Do you plan to add this feature (Route::transResource) to the next commit?

from localization.

arcanedev-maroc avatar arcanedev-maroc commented on June 8, 2024

I don't know 😕 , and to be honest with you, it's not a good idea.

The Route::resource may unintentionally take precedence over your supplemental routes.

And Route::resource + The Localization package = Nightmare.

If you want my advise, try to be explicit with your routes. It's like you're drawing paths (roads/routes) to your controllers.

from localization.

ppalella avatar ppalella commented on June 8, 2024

Ok, I understand... I will change my code. Thanks a lot!

from localization.

arcanedev-maroc avatar arcanedev-maroc commented on June 8, 2024

You're welcome 👍

from localization.

f-liva avatar f-liva commented on June 8, 2024

I think that transResource should be implemented, as Laravel provides Route::resource your package should support it, or at least provide a method like LaravelLocalization::transRoute that allows you to translate the route on the fly as on mcamara and make the resource work.

By not supporting Route::transResource you are discouraging the use of Laravel's good practices, which suggests using Route::resource in case of certain needs.

How can I help?

from localization.

arcanedev-maroc avatar arcanedev-maroc commented on June 8, 2024

Hi @fede91it,

TLDR: Feel free to make a PR with tests 👍

TBH, i'm not fan about the Route::resource because i prefer to create routes explicitly.

This is why the transResource method is not available.

By not supporting Route::transResource you are discouraging the use of Laravel's good practices, which suggests using Route::resource in case of certain needs.

I don't think this considered as a Laravel's good practices, this is just what we call a magic functionnality that allows you to do a lot of things & faster with little efforts.

The idea behind Route::resource method is to create the RESTful routes.
You can achieve that by using explicit routes

Wiki: https://en.wikipedia.org/wiki/Representational_state_transfer

My top 4 benefits about using explicit routes are:

  • 100% Total control of what i'm doing.
  • Easy route customization (without cheking the laravel's documentations or forums).
  • By reading the routes file(s), i have a clear view of the available routes without using the php artisan route:list command.
  • Prevents me to be a lazy person 😝

This is an example how i use & structure the routes in a OOP way in one of my projects:

This is just my opinion and i'm not against your suggestion, so feel free to make a PR to add this feature.

from localization.

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.