Giter Club home page Giter Club logo

Comments (11)

duncanmcclean avatar duncanmcclean commented on August 17, 2024

Can you try two things:

  1. Removing the with parameter from the {{ runway }} tag to see if that helps at all.
  2. Updating to Runway 6.2.0, which was released this morning. It makes some changes to relationship augmentation.

from runway.

icemancast avatar icemancast commented on August 17, 2024

1 and 2 failed. Removed with and upgraded to 6.2.0

from runway.

duncanmcclean avatar duncanmcclean commented on August 17, 2024

Can you share your Runway config, the code in your Category model and your category blueprint?

from runway.

icemancast avatar icemancast commented on August 17, 2024

Runway config:

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Resources
    |--------------------------------------------------------------------------
    |
    | Configure the resources (models) you'd like to be available in Runway.
    |
    */

    'resources' => [
        \App\Models\Community::class => [
            'name' => 'Communities',
            'cp_icon' => '<svg xmlns="http://www.w3.org/2000/svg" height="1.5em" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M207.3 36.7c2.5 8.5-2.3 17.4-10.8 19.9c-14.2 4.2-27.8 10-40.6 17c2.6 7 4 14.5 4 22.4c0 35.3-28.7 64-64 64c-7.9 0-15.4-1.4-22.4-4c-7 12.8-12.7 26.4-17 40.6c-2.5 8.5-11.4 13.3-19.9 10.8s-13.3-11.4-10.8-19.9c5.2-17.6 12.4-34.3 21.3-50C37.7 126.3 32 111.8 32 96c0-35.3 28.7-64 64-64c15.8 0 30.3 5.7 41.5 15.3c15.6-8.9 32.4-16.1 50-21.3c8.5-2.5 17.4 2.3 19.9 10.8zm97.3 0c2.5-8.5 11.4-13.3 19.9-10.8c17.6 5.2 34.3 12.4 50 21.3C385.7 37.7 400.2 32 416 32c35.3 0 64 28.7 64 64c0 15.8-5.7 30.3-15.3 41.5c8.9 15.6 16.1 32.4 21.3 50c2.5 8.5-2.3 17.4-10.8 19.9s-17.4-2.3-19.9-10.8c-4.2-14.2-10-27.8-17-40.6c-7 2.6-14.5 4-22.4 4c-35.3 0-64-28.7-64-64c0-7.9 1.4-15.4 4-22.4c-12.8-7-26.4-12.7-40.6-17c-8.5-2.5-13.3-11.4-10.8-19.9zm-268 268c8.5-2.5 17.4 2.3 19.9 10.8c4.2 14.2 10 27.8 17 40.6c7-2.6 14.5-4 22.4-4c35.3 0 64 28.7 64 64c0 7.9-1.4 15.4-4 22.4c12.8 7 26.4 12.7 40.6 17c8.5 2.5 13.3 11.4 10.8 19.9s-11.4 13.3-19.9 10.8c-17.6-5.2-34.3-12.4-50-21.3C126.3 474.3 111.8 480 96 480c-35.3 0-64-28.7-64-64c0-15.8 5.7-30.3 15.3-41.5c-8.9-15.6-16.1-32.4-21.3-50c-2.5-8.5 2.3-17.4 10.8-19.9zm438.6 0c8.5 2.5 13.3 11.4 10.8 19.9c-5.2 17.6-12.4 34.3-21.3 50c9.5 11.2 15.3 25.7 15.3 41.5c0 35.3-28.7 64-64 64c-15.8 0-30.3-5.7-41.5-15.3c-15.6 8.9-32.4 16.1-50 21.3c-8.5 2.5-17.4-2.3-19.9-10.8s2.3-17.4 10.8-19.9c14.2-4.2 27.8-10 40.6-17c-2.6-7-4-14.5-4-22.4c0-35.3 28.7-64 64-64c7.9 0 15.4 1.4 22.4 4c7-12.8 12.7-26.4 17-40.6c2.5-8.5 11.4-13.3 19.9-10.8zM96 128a32 32 0 1 0 0-64 32 32 0 1 0 0 64zm32 288a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zM416 128a32 32 0 1 0 0-64 32 32 0 1 0 0 64zm32 288a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zM144.8 168.8c0-8.8 7.2-16 16-16h45.6c14.6 0 26.4 11.8 26.4 26.4v45.6c0 8.8-7.2 16-16 16s-16-7.2-16-16V211.5c-10 12.4-16 28.1-16 45.3c0 28 15.9 52.2 39.3 64.2c7.9 4 11 13.7 7 21.5s-13.7 11-21.5 7c-33.6-17.2-56.7-52.2-56.7-92.7c0-27.6 10.8-52.8 28.4-71.4c.2-.2 .4-.4 .6-.6h-21c-8.8 0-16-7.2-16-16zm208 192H307.2c-14.6 0-26.4-11.8-26.4-26.4V288.8c0-8.8 7.2-16 16-16s16 7.2 16 16v11.7c10-12.4 16-28.1 16-45.3c0-28-15.9-52.2-39.3-64.2c-7.9-4-11-13.7-7-21.5s13.7-11 21.5-7c33.6 17.2 56.7 52.2 56.7 92.7c0 27.6-10.8 52.8-28.4 71.4c-.8 .8-1.6 1.6-2.5 2.2h22.9c8.8 0 16 7.2 16 16s-7.2 16-16 16z"/></svg>',
            'route' => '/communities/{{ slug }}',
            'template' => 'communities.show',
            'layout' => 'layout',
        ],

        \App\Models\Event::class => [
            'name' => 'Events',
            'cp_icon' => '<svg xmlns="http://www.w3.org/2000/svg" height="1.5em" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M208 0c8.8 0 16 7.2 16 16V64H384V16c0-8.8 7.2-16 16-16s16 7.2 16 16V64h32c35.3 0 64 28.7 64 64v64V352c0 35.3-28.7 64-64 64H160c-35.3 0-64-28.7-64-64V192 128c0-35.3 28.7-64 64-64h32V16c0-8.8 7.2-16 16-16zM160 96c-17.7 0-32 14.3-32 32v32H480V128c0-17.7-14.3-32-32-32H160zm320 96H128V352c0 17.7 14.3 32 32 32H448c17.7 0 32-14.3 32-32V192zM32 208V384c0 53 43 96 96 96H368c8.8 0 16 7.2 16 16s-7.2 16-16 16H128C57.3 512 0 454.7 0 384V208c0-8.8 7.2-16 16-16s16 7.2 16 16z"/></svg>',
            'route' => '/events/{{ slug }}',
            'template' => 'events.show',
            'layout' => 'layout',
            'order_by' => 'start_at',
            'order_by_direction' => 'DESC',
        ],

        \App\Models\Region::class => [
            'name' => 'Regions',
            'cp_icon' => '<svg xmlns="http://www.w3.org/2000/svg" height="1.5em" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M181.3 32.5c1.6-.6 3.4-.6 5.1-.1L391.8 95.6 533.1 44.2c20.9-7.6 42.9 7.9 42.9 30.1V391.2c0 13.5-8.4 25.5-21.1 30.1L394.7 479.5c-1.6 .6-3.4 .6-5.1 .1L184.2 416.4 42.9 467.8C22.1 475.4 0 459.9 0 437.7V120.8c0-13.5 8.4-25.5 21.1-30.1L181.3 32.5zM26.5 105.8c-6.3 2.3-10.5 8.3-10.5 15V437.7c0 11.1 11 18.8 21.5 15L176 402.4V51.4L26.5 105.8zM384 461.2V109.9L192 50.8V402.1l192 59.1zm16-.6l149.5-54.4c6.3-2.3 10.5-8.3 10.5-15V74.3c0-11.1-11-18.8-21.5-15L400 109.6v351z"/></svg>',
            'route' => '/regions/{{ slug }}',
            'template' => 'regions.index',
            'layout' => 'layout',
        ],

        \App\Models\Category::class => [
            'name' => 'Categories',
            'route' => '/categories/{{ slug }}',
            'template' => 'categories.index',
            'layout' => 'layout',
            'cp_icon' => 'select',
        ],

        \App\Models\Tag::class => [
            'name' => 'Tags',
            'cp_icon' => 'tags',
            'route' => '/tags/{{ slug }}',
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Disable Migrations?
    |--------------------------------------------------------------------------
    |
    | Should Runway's migrations be disabled?
    | (eg. not automatically run when you next vendor:publish)
    |
    */

    'disable_migrations' => false,

];

from runway.

icemancast avatar icemancast commented on August 17, 2024

Models/Category.php

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use StatamicRadPack\Runway\Traits\HasRunwayResource; 
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use StatamicRadPack\Runway\Routing\Traits\RunwayRoutes;

class Category extends Model
{
    use HasFactory;
    use HasRunwayResource;
    use RunwayRoutes;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'title',
        'slug',
        'description',
        'image',
        'icon_image',
    ];

    /**
     * The communities that belong to the category.
     */
    public function communities(): BelongsToMany
    {
        return $this->belongsToMany(Community::class);
    }

    public function scopeCategory($query, $slug)
    {
        $query->where('slug', $slug);
    }
}

from runway.

icemancast avatar icemancast commented on August 17, 2024

Category Blue Print

title: Category
tabs:
  main:
    display: Main
    sections:
      -
        fields:
          -
            handle: title
            field:
              type: text
              required: true
              validate:
                - required
          -
            handle: icon_image
            field:
              max_files: 1
              mode: list
              container: assets
              folder: categories
              restrict: false
              allow_uploads: true
              show_filename: true
              show_set_alt: true
              type: assets
              display: Icon
              icon: assets
              listable: hidden
              instructions_position: above
              visibility: visible
              replicator_preview: true
              hide_display: false
          -
            handle: image
            field:
              max_files: 1
              mode: list
              container: assets
              restrict: false
              allow_uploads: true
              show_filename: true
              show_set_alt: true
              type: assets
              display: Image
              icon: assets
              listable: hidden
              instructions_position: above
              visibility: visible
              replicator_preview: true
              hide_display: false
          -
            handle: description
            field:
              restrict: false
              buttons:
                - bold
                - italic
                - unorderedlist
                - orderedlist
                - quote
                - link
                - image
                - table
              automatic_line_breaks: true
              automatic_links: false
              escape_markup: false
              heading_anchors: false
              smartypants: false
              table_of_contents: false
              antlers: false
              type: markdown
              display: Description
              icon: markdown
              listable: hidden
              instructions_position: above
              visibility: visible
              replicator_preview: true
              hide_display: false
  sidebar:
    display: Sidebar
    sections:
      -
        fields:
          -
            handle: slug
            field:
              type: slug
              localizable: true

from runway.

duncanmcclean avatar duncanmcclean commented on August 17, 2024

You're missing a communities HasMany field from your blueprint.

from runway.

icemancast avatar icemancast commented on August 17, 2024

Hmmm I wonder if that dropped during the php artisan blueprint migrate command

from runway.

icemancast avatar icemancast commented on August 17, 2024

Yup that worked have to do some massaging but that worked now.

from runway.

duncanmcclean avatar duncanmcclean commented on August 17, 2024

It may have worked by happy accident in v5 but it's now required in v6.

from runway.

icemancast avatar icemancast commented on August 17, 2024

Ah that makes sense we can close this issue then, all is working.

from runway.

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.