https://twill.io logo
Join Discord
Powered by
# ❓questions
  • o

    onepiece

    09/15/2022, 10:06 AM
    hey guys How can I use package routes in project routes? For example, the route located in admin.php of the package I want to use in admin.php of the project. Btw (the package is not at the Packagist, I am testing it locally)
  • o

    onepiece

    09/15/2022, 10:19 AM
    If I can use
  • i

    ifox

    09/15/2022, 10:24 AM
    i don't understand what you mean by using a route from the package in the project route. What are you trying to do?
  • o

    onepiece

    09/15/2022, 10:28 AM
    When I try to access the url, http://admin.localhost:8000/leads I get the error because that route is in the package and not in the project route
  • o

    onepiece

    09/15/2022, 10:31 AM
    in package providers public function boot(): void { $this->loadRoutesFrom(__DIR__.'/Twill/Capsules/Leads/routes/admin.php'); }
  • i

    ifox

    09/15/2022, 10:31 AM
    it's not about having a route from the package in your app route file, it's about registering your routes in the package.
  • i

    ifox

    09/15/2022, 10:32 AM
    I don't think you're supposed to load them manually, the twill package service provider does that unless I'm missing something
  • o

    onepiece

    09/15/2022, 10:35 AM
    How can I do it Any suggestions?
  • h

    Harings Rob

    09/15/2022, 10:39 AM
    Hey @onepiece here is an example of a twill package: https://github.com/Sevendays-Digital/twill-redirects There should be no route loading as that should be automatically.
  • h

    Harings Rob

    09/15/2022, 10:39 AM
    It even adds the menu entry automatically.
  • h

    Harings Rob

    09/15/2022, 10:40 AM
    just make sure you extend
    TwillPackageServiceProvider
  • h

    Harings Rob

    09/15/2022, 10:40 AM
    If you put something in the boot method, make sure to call parent::boot()
  • h

    Harings Rob

    09/15/2022, 10:41 AM
    https://github.com/area17/twill/blob/f289cb331d04172be17a630e331616cbf6297c9e/src/TwillPackageServiceProvider.php
  • i

    Ivan Markov

    09/15/2022, 12:09 PM
    Hello. Help to understand the mismatch of slug parameters. Why does it return an inactive slug? An example of data output already on a previously saved (unchanged) model
  • i

    ifox

    09/15/2022, 12:15 PM
    hi @Ivan Markov what about if you dd after the parent:: call?
  • i

    Ivan Markov

    09/15/2022, 12:41 PM
    thanks. 🥹
  • o

    onepiece

    09/15/2022, 2:43 PM
    Hello guys. When I add to the ServiceProvider package to the public function register() this ($this->loadRoutesFrom( __DIR__.'/Twill/Capsules/Leads/routes/admin.php'); ) I get this error
  • o

    onepiece

    09/15/2022, 2:44 PM
    while when I add it to public function boot(): void { $this->loadRoutesFrom(__DIR__.'/Twill/Capsules/Leads/routes/admin.php'); parent::boot(); } I get this error
  • i

    ifox

    09/15/2022, 2:50 PM
    @onepiece you need to read our answers. You're not supposed to have to do this.
  • i

    ifox

    09/15/2022, 2:51 PM
    https://discord.com/channels/811936425858695198/811986149064441927/1019920379810156564
  • i

    ifox

    09/15/2022, 2:51 PM
    https://github.com/Sevendays-Digital/twill-redirects/blob/main/src/TwillRedirectsServiceProvider.php
  • i

    ifox

    09/15/2022, 2:51 PM
    As you can see, no
    loadRoutesFrom
  • i

    ifox

    09/15/2022, 2:53 PM
    @Harings Rob capsules routes are autoloaded for sure, what about having routes of a regular module in a package?
  • o

    onepiece

    09/15/2022, 2:53 PM
    I read them but it didn't work. in admin.php I have more than one route
  • i

    ifox

    09/15/2022, 2:55 PM
    having multiple routes is not an issue, most likely the folder structure of your package is wrong
  • i

    ifox

    09/15/2022, 2:56 PM
    try to match what the package we provided as an exemple does
  • i

    ifox

    09/15/2022, 2:57 PM
    eg. do you have
    src/Twill/Capsules/Leads
    in your package?
  • o

    onepiece

    09/15/2022, 2:58 PM
    yep,i have
  • i

    ifox

    09/15/2022, 3:00 PM
    your controllers namespace seems very strange
  • o

    onepiece

    09/15/2022, 3:01 PM
    The package contains a table (itself a crud) where the admin can manage all the emails coming from the subscription
1...393394395...484Latest