https://twill.io logo
Join Discord
Powered by
# 👊support
  • dashboard route
    b

    bohous

    04/25/2023, 10:25 PM
    Hello. I have a problem with dashboard config I have a Category and CategoryArticle Models I have a dashboard config in twill.php
    Copy code
    'dashboard' => [
            'modules' =>
                [
                    'categories' =>
                        [
                            'name' => 'categories',
                            'label' => 'Category',
                            'create' => true,
                            'search' => true,
                            'count' => true,
                        ],
                    'category' =>
                        [
                            'name' => 'categoryArticle',
                            'label' => 'Article',
                            'create' => true,
                            'search' => true,
                            'count' => true,
                        ]
                ]
        ]
    With config like that id i go to dashboard I have a error
    Copy code
    Route [twill.categoryArticle.index] not defined.
    my route twill.php file
    Copy code
    TwillRoutes::module('categories');
    TwillRoutes::module('categories.articles');
    where I make a error.? Thx for answer
    k
    i
    • 3
    • 10
  • Displaying Block elements on the Front Page
    z

    zeenux

    04/27/2023, 7:24 PM
    how do you display block elements on the frontpage? And i don't mean the preview file. I want to access the block elements like $item->block like that.
    i
    • 2
    • 7
  • Fetch all models with field value of X
    u

    undersound

    04/28/2023, 8:53 AM
    Sorry to ask such a basic question but I want to do the following.... I have a model called Work (and a WorkController and WorkRepository). On my Work module there is a field called "available" of type checkbox. Now i want to fetch all models with "available" selected. 1. What is best practice to implement a e.g. getAllAvailable() method? Is that on the WorkRepository, WorkController of Work model class? 2. How do I select all the models with that checkbox selected. In the laravel docs I saw this
    $flights = Flight::where('destination', 'Paris')->get();
    but I can't seem to use the where function on my model. E.g. Work::where is not working. Thanks for any guidance
    a
    • 2
    • 18
  • $renderData returns null when trying to render nestedblocks
    t

    thelongestsigh

    04/28/2023, 9:44 AM
    @php /** @var \A17\Twill\Services\Blocks\RenderData $renderData */ dd($renderData) @endphp
    i
    • 2
    • 2
  • Adding custom blocks to modules
    z

    zeenux

    04/29/2023, 4:45 PM
    How do you add custom blocks to modules? Generally i add blocks to a module using $form->add(BlockEditor::make()) within the controller getForm Method. However if i have created a custom block class named EditorBlade and i try to add it like $form->add(EditorBlade::make()) it gives me an error of call to undefined method Editor::make().
    i
    • 2
    • 2
  • Repeater without blocks
    z

    zeenux

    04/30/2023, 2:39 PM
    How do you add and render a repeater without including it in the block?
    p
    • 2
    • 1
  • Fetch all images in a block
    z

    zeenux

    05/01/2023, 1:59 PM
    How do you fetch all the images in a block? For e.g i have this block <x-twill::medias name="slide" label="Slide Show Image" max=10 /> I want to render this block into a slideshow. However this doesn't work @foreach ($block->images('slide') as $image ) @endforeach Help would be appreciated.
    p
    • 2
    • 3
  • Render repeater in block blade file
    h

    Hoang

    05/03/2023, 6:06 PM
    I have made a block named "gallery" with a repeater containing medias named "gallery-item", please help me to display the images in the blade file of the block. (I tried with regular block with {{ $block->image(...) }} but don't know how to do with blocks with repeaters). I tried this example but it doesn't work: https://twillcms.com/docs/block-editor/creating-a-block-editor.html#content-rendering-helpers Thank you very much.
    p
    g
    • 3
    • 4
  • New Settings approach
    a

    AntonyPL

    05/04/2023, 7:26 AM
    Hey, a i have a small question - how build a settings page like in https://demo.twill.io/settings/seo using a new appproach ? I mean, how add a multiple blocks with custom name on grey bar ?

    https://cdn.discordapp.com/attachments/1103583421755834499/1103583422007480340/Zrzut_ekranu_2023-05-04_092603.png▾

    i
    • 2
    • 5
  • Custom form fields
    t

    thelongestsigh

    05/04/2023, 8:55 AM
    I'm trying to make a custom form field to override the custom WYSIWYG form field. I've followed this guide https://twillcms.com/guides/creating_custom_components_form_fields_and_blocks.html I feel like there are some steps left out of there. For example where do i need to define the Vue component? Is there a config file for that. I've been snooping around in twill source and i see everything is stored in A17Config but how could i override this or solve this. Maybe there is another way to add custom css to a WYSIWYG form field or alter tiptap config?
    i
    c
    • 3
    • 83
  • New module item error
    t

    thelongestsigh

    05/04/2023, 1:06 PM
    When i make a new module i get this error, i'm using the twill metadata pacakage
    Copy code
    Object { message: "Illuminate\\Database\\Grammar::parameterize(): Argument #1 ($values) must be of type array, string given, called in /var/www/libera/website/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php on line 1022", exception: "TypeError", file: "/var/www/libera/website/vendor/laravel/framework/src/Illuminate/Database/Grammar.php", line: 168, trace: (72) […] }
    p
    • 2
    • 5
  • Legacy Settings Sections return values doesn't work
    a

    AntonyPL

    05/05/2023, 6:34 AM
    Hi, After save Settings to database, values doesn't bind in inputs. How fixed this @ifox ?

    https://cdn.discordapp.com/attachments/1103932645773160510/1103932646494588928/Zrzut_ekranu_2023-05-05_083330.png▾

    k
    i
    • 3
    • 39
  • Preview Modules
    z

    zeenux

    05/08/2023, 12:49 PM
    Hey how do you go about previewing modules? There is not a lot of documentation available. How do you handle route. When you click on the route that is generated by the backend for instance http://localhost:9000/en/pages/intro the result is not found. If i add a route which routes to the view located at the /site/modulename.blade.php it returns an error $item not found.
    i
    • 2
    • 9
  • Updating Translations from the Command Line
    d

    dpadular

    05/09/2023, 6:06 PM
    Hi all, as usual I assume I'm misunderstanding something basic about how Laravel works, but I have been stuck trying to update existing translations directly with data from a Console Command. I'm trying to back-fill some missing information that I'm scraping from HTML files. I have tried several different combinations of querying the database to get the existing record and updating it, but nothing seems to work. I can verify that the entry I'm trying to update exists in the database, but when I try to
    update()
    or
    save()
    I just don't get any results, and don't get any errors. This is my current attempt to query out the existing entries. Not sure how to update the model that this returns.
    Copy code
    $existingProduct = Product::join('product_translations', 'products.id' , '=', 'product_translations.product_id')
                        ->where('title', $productTitle)
                        ->where('locale', 'en')
                        ->where('products.deleted_at', null)
                        ->where('product_translations.deleted_at', null)
                        ->where('brand_id', $brandId)
                        ->first();
    • 1
    • 3
  • Twill advanced permissions
    z

    zeenux

    05/10/2023, 12:34 PM
    I've followed the documentation with regard to adding the enabled and permission key to config/twill.php. I ran the migrations, although it reported back there were no migrations. However i don't see the permissions tab in my module. What am i missing?
    i
    • 2
    • 45
  • Hi, do you know where I can add another link?
    h

    helloworld

    05/11/2023, 5:31 AM
    Aligned with All Items, Published, Draft and Trashed. I just want to add new link
    i
    • 2
    • 6
  • v3 Package creation - version mismatch
    c

    crp87

    05/11/2023, 8:26 AM
    Hey, I started installing twill 3 n a fresh Jetstream based laravel App. I could also create my first package but it looks like the package requires twill v2.6 instead of 3. Updating the composer.json file of the newly created package helps but maybe there will be follow up errors?
    i
    • 2
    • 2
  • v3 package resources / blade templates
    c

    crp87

    05/11/2023, 9:10 AM
    I created a fresh v3 package but inside the documentation I can’t find a description on how to add blade templates. Right now I follow the guide on how to manage frontend users as profiles but I want to create corresponding admin/repeaters/tasks.blade.php and other views inside the package so I can reuse it easier on new projects and also distribute the package later. Looks like there is a mix between v2 and v3 stuff in the documentation as well? Because there is nonstick directory: resources/views/admin/repeaters/
    i
    • 2
    • 2
  • Twill + Spatie permissions
    z

    zeenux

    05/11/2023, 11:00 AM
    How would someone go about implementing spatie permissions in Twill. The spatie permissions are pretty comprehensive. For e.g If i wanted certain articles in a module article to be accessible only to a certain group, Twill doesn't have permission management for such a scenario. So how would one implement them in the CMS?
    i
    p
    • 3
    • 9
  • ->getRelated for menu didnt work.
    b

    bohous

    05/13/2023, 4:43 AM
    I follow this manual https://twillcms.com/guides/page-builder-with-blade/adding-navigation.html I do all the thinks which is there, I do some links to my pages in twill I will be see a relatitons in twill table
    Copy code
    MariaDB [laravel]> select * from  twill_related;
    +----+------------+-------------------------+------------+-----------------+--------------+----------+
    | id | subject_id | subject_type            | related_id | related_type    | browser_name | position |
    +----+------------+-------------------------+------------+-----------------+--------------+----------+
    |  1 |          2 | App\Models\MenuPageLink |          7 | App\Models\Page | page         |        1 |
    |  2 |          3 | App\Models\MenuPageLink |          8 | App\Models\Page | page         |        1 |
    |  3 |          4 | App\Models\MenuPageLink |          6 | App\Models\Page | page         |        1 |
    But when I call in compoment
    $link->getRelated('page')->first()->slug}}
    I have this error
    Attempt to read property "slug" on null
    In my code. The
    MenuPageLink.php
    is
    use  HasRelated;
    In
    MenuPageLinkRepository.php
    is
    protected $relatedBrowsers = ['page'];
    and
    use HandleNesting;
    In
    MenuPageLinkController
    is
    $form->add(Browser::make()->name('page')->modules([Page::class]));
    I didnt understod what is wrong and why the
    getRelated()
    didnt get the relations. Thx for answer
    i
    • 2
    • 2
  • adding a custom link in the dashboard
    z

    zeenux

    05/13/2023, 10:44 AM
    Is there any way to add a link to a custom page in the dashboard? like adding the link in dashbord.modules array in config/twill.php. Twill 3
    i
    • 2
    • 2
  • How to create multiple navigations with multiple levels based on the navigation Guide
    c

    crp87

    05/16/2023, 6:33 PM
    Following the Guide at https://twillcms.com/guides/page-builder-with-blade/adding-navigation.html it's straight forward to integrate a navigation with page browser. But what if you want to create multiple navigations: primary, sidebar, footer And maybe they also have different levels. So the one starting with "Startseite" would be primary one but "test" should not be a second level navigation item. They should be on one level as primary navigation but another level would be a submenu for example. "Menü 2" could be a separate navigation which should not be rendered with the primary navigation items.

    https://cdn.discordapp.com/attachments/1108099900211740772/1108099900471783444/Bildschirmfoto_2023-05-16_um_20.31.36.png▾

    i
    • 2
    • 2
  • Select Field
    h

    helloworld

    05/17/2023, 9:03 AM
    Hi, is there a way to search an item in a select block? Just like autocomplete
    i
    • 2
    • 2
  • Third Level Categories
    h

    helloworld

    05/19/2023, 7:50 AM
    How do we set our model to cater a third level category or parent->child->child? Currently it only cater until 2nd level. Please see attached image. I wan to create another child of "Another Product", though it was saved into the database but I cannot be displayed.

    https://cdn.discordapp.com/attachments/1109025375973015682/1109025376094654545/Screenshot_2023-05-19_at_3.49.35_PM.png▾

    p
    • 2
    • 2
  • fileparams in Model
    z

    zeenux

    05/19/2023, 1:14 PM
    Is there any documentation on fileparams. For instance how to add file types parameter to it
    k
    i
    • 3
    • 4
  • DatePicker not updating or incorrectly updating field
    k

    kerkness

    05/19/2023, 1:33 PM
    Having a weird issue with the DatePicker field which seems to have popped up in the last few weeks or so (project is still in development so not sure exactly when it started happening). DatePicker was working previously. Running 3.0.1 and I have ran
    twill:update
    Two issues appear to be happening. 1) If I enter a date into the field then field saves as the previous day. Example, if I enter "May 15, 2023" the payload sent to twill submits "2023-05-15" but the value saved into the database is "2023-05-14" 2) If I select a date from the DatePicker popup then the payload is not updated unless I hit the "enter key". Removing focus from the field does not update the payload. The module has the following migrations:
    Copy code
    $table->date('start_date')->nullable();
    $table->date('end_date')->nullable();
    (These are not publish dates, they meant to show the start and end dates of an event.) The model casts these fields to date and also includes
    $dates
    as the docs seem to suggest. Although I'm pretty sure having both is redundant.
    Copy code
    public $casts = [
       'start_date' => 'date',
       'end_date' => 'date',
    ];
    
    public $dates = ['start_date', 'end_date'];
    The controller uses
    getForm
    method and adds fields with the following
    Copy code
    $form->add(
        Columns::make()
            ->left(
                [DatePicker::make()
                    ->name('start_date')
                    ->allowInput(true)
                    ->withoutTime(true)
                    ->allowClear(true)]
            )
            ->right(
                [DatePicker::make()
                    ->name('end_date')
                    ->allowInput(true)
                    ->withoutTime(true)
                    ->allowClear(true)]
            )
    );
    i
    • 2
    • 5
  • Define Settings-Views inside a package>capsule
    c

    crp87

    05/22/2023, 2:35 PM
    Is there a way to configure a settings related view inside a package capsule? I couldn't find something about that one. For example a "registerSettingsViewPath" or a property/method returning an explicit view for the related settings.
    i
    • 2
    • 5
  • Checked checkboxes by default
    s

    savchuk.ivan

    05/23/2023, 4:39 AM
    Good afternoon (morning)! I use the Multiple Checkboxes field How can I make certain fields checked by default? For example arts and civic (in the example).

    https://cdn.discordapp.com/attachments/1110426789353885726/1110426789496504471/2023-05-23_113751.png▾

    k
    • 2
    • 1
  • Slows down the page after saving the @formConnectedFields field
    s

    savchuk.ivan

    05/23/2023, 8:51 AM
    Good afternoon I have several roles to which I want to attach the ability to select certain actions (publishing a post, unpublishing, for example). The problem is that after saving, when you click on the checkbox again, the page slows down and crashes with an error that the page is not responding. I also found a problem that if you save a user with a role, for example, an administrator, then the saved field is displayed under the role, for example, a reader (that is, there must be an understanding that the saved fields belong to a particular role).
    Copy code
    @formField('select', [
                'name' => "role",
                'label' => twillTrans('twill::lang.user-management.role'),
                'options' => $roleList,
                'placeholder' => twillTrans('twill::lang.user-management.role-placeholder'),
                ])
    
                @formConnectedFields([
                'fieldName' => 'role',
                'fieldValues' => ['ADMIN'],
                'renderForBlocks' => false,
                ])
    
                @formField('checkboxes', [
                'name' => 'privilege',
                'label' => 'Привилегии',
                'inline' => false,
                'options' =>
                    \App\Domain\Enum\PrivilegeType::values(),
    
                ])
    
                @endformConnectedFields
    
                @formConnectedFields([
                'fieldName' => 'role',
                'fieldValues' => ['READER'],
                'renderForBlocks' => false,
                ])
    
                @formField('checkboxes', [
                'name' => 'privilege',
                'label' => 'Привилегии',
                'inline' => false,
                'options' =>
                \App\Domain\Enum\PrivilegeType::values(),
    
                ])
    @endformConnectedFields
  • BlockComponent blocks are not available in BlockEditor
    z

    ZiPavlin

    05/24/2023, 7:58 AM
    I created blocks using
    php artisan twill:make:componentBlock name
    as per documentation, but none of them are available in block editor. I think I set up BlockEditor as it should be
    BlockEditor::make()->blocks(['Columns', 'text', 'imagetext', 'image'])
    . Do I need to register BlockComponents somewhere?
    • 1
    • 1