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

    Harings Rob

    09/21/2022, 10:51 AM
    Wait, that is already there.
  • h

    Harings Rob

    09/21/2022, 10:52 AM
    hey @mateoD can you show your morphmap for people?
  • i

    ifox

    09/21/2022, 10:53 AM
    @Harings Rob the fix is in 3.x not 2.x
  • h

    Harings Rob

    09/21/2022, 10:54 AM
    it's there in 2.x https://github.com/area17/twill/blob/2.x/src/Http/Controllers/Admin/DashboardController.php#L157
  • m

    mateoD

    09/21/2022, 10:54 AM
    where can i find morphmap in files to show you ?
  • i

    ifox

    09/21/2022, 10:54 AM
    Oh sorry I was looking at an earlier commit hash
  • h

    Harings Rob

    09/21/2022, 10:55 AM
    If you have no morph map defined, then I feel your dashboard config is invalid.
  • h

    Harings Rob

    09/21/2022, 10:55 AM
    A morphmap looks like this:
    Copy code
    Relation::morphMap([
                'events' => 'App\Models\Event',
                'articles' => 'App\Models\Article',
                'pages' => '\App\Models\Page',
                'modules' => '\App\Models\Module',
                'speakers' => '\App\Models\Speaker',
            ]);
  • h

    Harings Rob

    09/21/2022, 10:56 AM
    It makes a link between your string "people" and the model class.
  • h

    Harings Rob

    09/21/2022, 10:56 AM
    I think before it failed silently. But now it shows the error because it is not configured correctly.
  • m

    mateoD

    09/21/2022, 10:57 AM
    where should i put this script ?
  • h

    Harings Rob

    09/21/2022, 10:59 AM
    did people ever show up in your dashboard before 2.9?
  • m

    mateoD

    09/21/2022, 11:01 AM
    yes before update they shows exactly
  • h

    Harings Rob

    09/21/2022, 11:03 AM
    Can you share the dashboard config? You can also pm it to me if it is private
  • h

    Harings Rob

    09/21/2022, 11:10 AM
    that's impossible 😄 there must be a morphMap defined somewhere for this to work afaik. In your activities table do
    subject_type
    do you see people or a namespace?
  • i

    ifox

    09/21/2022, 11:27 AM
    check your AppServiceProvider @mateoD
  • m

    mateoD

    09/21/2022, 12:06 PM
    i registered this morph map to appServiceProvider and now a got this error
    Copy code
    Class App\Models\People specified in twill.dashboard configuration does not exists.
  • h

    Harings Rob

    09/21/2022, 12:07 PM
    Either prefix it with
    \
    or make it
    \App\Models\People::class
    (but without quotes)
  • h

    Harings Rob

    09/21/2022, 12:07 PM
    'peaple` => \App\Models\People::class
  • k

    kalle

    09/21/2022, 12:09 PM
    Try like this. Ive had those issue before too, found this answer on web.
    Copy code
    php
    return [
        'dashboard' => [
            'modules' => [
                'App\Models\People' =>[ // Or change name if name of the model is diffrent
                    'name' => 'people',
                    'label' => 'People',
                    'count' => true,
                    'create' => true,
                    'activity' => true,
                    'draft' => false,
                    'search' => true,
                    'search_fields' => ['first_name', 'last_name']
                ],
  • m

    mateoD

    09/21/2022, 12:11 PM
    now it works thank you all 🙂
  • h

    Harings Rob

    09/21/2022, 12:11 PM
    I still do not understand how it would have ever worked before
  • m

    mateoD

    09/21/2022, 12:13 PM
    I don't know, but before it worked fine in some projects I worked on
  • j

    JeanSilva

    09/21/2022, 1:38 PM
    Hi I need some help. I'm creating a controller route to test some things on twill, and I've loaded a TwillUser object from twill_user table (class TwillUser that extends User from Twill). I'm trying to get its fields (like "name" for example), but it always returns a null when trying to use standard laravel (I'm trying $twillUser->name, for example). Does it works differently than standard laravel models? How can I get its fields values?
    i
    • 2
    • 5
  • t

    tfilos

    09/21/2022, 3:06 PM
    Here's a confusing one. This just started today --- this module is only showing the first model even though there are six. Clicking on mine or published it still only shows one. The only place you see more is on the Trash tab.
  • t

    tfilos

    09/21/2022, 3:08 PM
    I checked the queries and I see the one that's grabbing the models, and it is definitely getting all six on the query level. I tried it directly in mysql for good measure
  • t

    tfilos

    09/21/2022, 3:08 PM
    Oddly all other modules are showing me all expected rows, it's just this one.
  • t

    tfilos

    09/21/2022, 3:09 PM
    Only thing I can think of is looking at differences between admin controllers, even though nothing has changed since this stopped working
  • t

    tfilos

    09/21/2022, 3:10 PM
    This one is also NestedModuleController while the others are just ModuleController
  • t

    tfilos

    09/21/2022, 3:10 PM
    That might be a good thread to investigate, will take a look
1...402403404...484Latest