Closed itsmesaskovic closed 11 months ago
Are you able to share your Runway config file?
Sure:
<?php
return [
'connection' => env('STATAMIC_ELOQUENT_CONNECTION', ''),
'table_prefix' => env('STATAMIC_ELOQUENT_PREFIX', ''),
'asset_containers' => [
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Assets\AssetContainerModel::class,
],
'assets' => [
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Assets\AssetModel::class,
'asset' => \Statamic\Eloquent\Assets\Asset::class,
],
'blueprints' => [
'driver' => 'eloquent',
'blueprint_model' => \Statamic\Eloquent\Fields\BlueprintModel::class,
'fieldset_model' => \Statamic\Eloquent\Fields\FieldsetModel::class,
],
'collections' => [
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Collections\CollectionModel::class,
'update_entry_order_queue' => 'default',
],
'collection_trees' => [
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Structures\TreeModel::class,
'tree' => \Statamic\Eloquent\Structures\CollectionTree::class,
],
'entries' => [
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Entries\UuidEntryModel::class,
'entry' => \Statamic\Eloquent\Entries\Entry::class,
],
'forms' => [
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Forms\FormModel::class,
'submission_model' => \Statamic\Eloquent\Forms\SubmissionModel::class,
],
'global_sets' => [
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Globals\GlobalSetModel::class,
],
'global_set_variables' => [
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Globals\VariablesModel::class,
],
'navigations' => [
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Structures\NavModel::class,
],
'navigation_trees' => [
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Structures\TreeModel::class,
'tree' => \Statamic\Eloquent\Structures\NavTree::class,
],
'revisions' => [
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Revisions\RevisionModel::class,
],
'taxonomies' => [
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Taxonomies\TaxonomyModel::class,
],
'terms' => [
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Taxonomies\TermModel::class,
],
];
That's your eloquent-driver.php
config file, not your Runway config file.
You're right 😁
I've already tried setting disable_migrations
to true and false.
<?php
return [
/*
|--------------------------------------------------------------------------
| Resources
|--------------------------------------------------------------------------
|
| Configure the resources (models) you'd like to be available in Runway.
|
*/
'resources' => [
\App\Models\CustomerModel::class => [
'name' => 'Customers',
'handle' => 'customers',
'blueprint' => 'customer',
'hidden' => true,
'read_only' => false,
],
\App\Models\OrderModel::class => [
'name' => 'Orders',
'handle' => 'orders',
'blueprint' => 'order',
'hidden' => true,
'read_only' => false,
],
],
/*
|--------------------------------------------------------------------------
| Disable Migrations?
|--------------------------------------------------------------------------
|
| Should Runway's migrations be disabled?
| (eg. not automatically run when you next vendor:publish)
|
*/
'disable_migrations' => true,
];
Okay - what do the two blueprints look like? resources/blueprints/order.yaml
and resources/blueprints/customer.yaml
?
title: Order
sections:
main:
display: Main
fields:
- handle: id
field:
type: integer
required: true
display: "ID"
input_type: text
antlers: false
read_only: true
width: 33
- handle: order_number
field:
type: text
required: true
validate:
- required
display: "Order nummer"
input_type: text
antlers: false
read_only: true
width: 33
- handle: is_paid
field:
type: toggle
display: "Betaald?"
width: 33
read_only: true
- handle: customer_id
field:
max_items: 1
mode: default
resource: customers
display: Customer
type: belongs_to
icon: belongs_to
listable: hidden
instructions_position: above
width: 50
read_only: true
- handle: coupon
field:
max_items: 1
mode: select
collections:
- coupons
type: entries
display: Coupon
width: 50
read_only: true
-
handle: verzonden
field:
display: "Verzonden"
type: toggle
icon: toggle
width: 50
read_only: false
instructions_position: above
if:
is_paid: 'equals true'
-
handle: pakket_link
field:
display: 'Pakket link'
type: link
icon: link
width: 50
read_only: false
instructions_position: above
if:
verzonden: 'equals true'
- handle: items
field:
fields:
- handle: id
field:
type: hidden
listable: hidden
display: ID
- handle: product
field:
max_items: 1
mode: default
collections:
- products
type: entries
listable: hidden
display: Product
validate: required
width: 50
- handle: variant
field:
display: Variant
type: product_variant
icon: product_variant
width: 50
listable: hidden
- handle: quantity
field:
input_type: number
type: text
listable: hidden
display: Quantity
width: 50
- handle: total
field:
read_only: false
type: money
listable: hidden
display: Total
validate: required
width: 50
- handle: metadata
field:
mode: dynamic
display: Metadata
type: array
icon: array
listable: hidden
- handle: tax
field:
type: sc_line_items_tax
mode: stacked
reorderable: false
type: grid
listable: true
display: "Bestelde boeken"
min_rows: 1
add_row: "Add Line Item"
read_only: true
- handle: gateway
field:
display: Gateway
type: gateway
icon: gateway
width: 50
listable: hidden
instructions_position: above
addresses:
display: Addresses
fields:
- handle: shipping_section
field:
type: section
listable: false
display: "Verzendgegevens"
- handle: radio_dhl_servicepoint
field:
options:
DHL: 'Dichtsbijzijnde DHL ServicePoint'
ADDRESS: 'Bovenstaand adres'
MONDIAL: 'Mondial Relay België'
inline: false
cast_booleans: false
default: '0'
display: 'Radio DHL servicepoint'
type: radio
icon: radio
listable: true
instructions_position: above
width: 50
- handle: dhl_servicepoint_name
field:
antlers: false
display: 'DHL ServicePoint naam'
type: textarea
icon: textarea
listable: hidden
instructions_position: above
width: 50
- handle: shipping_name
field:
input_type: text
type: text
listable: true
display: "Voor- en achternaam"
width: 50
read_only: true
- handle: shipping_country
field:
input_type: text
type: text
display: "Land"
width: 50
antlers: false
read_only: true
- handle: shipping_postal_code
field:
input_type: text
type: text
width: 50
listable: false
display: "Postcode"
read_only: true
- handle: shipping_address_line2
field:
input_type: text
antlers: false
display: "Huisnummer (+evt. toevoeging)"
type: text
icon: text
width: 50
listable: hidden
read_only: true
- handle: shipping_email
field:
input_type: text
antlers: false
display: 'E-mailadres klant'
type: text
icon: text
listable: true
instructions_position: above
width: 75
read_only: true
- handle: shipping_address
field:
input_type: text
type: text
listable: false
display: "Straatnaam"
width: 50
antlers: false
read_only: true
- handle: shipping_city
field:
input_type: text
type: text
listable: false
display: "Woonplaats"
width: 50
read_only: true
- handle: billing_section
field:
type: section
listable: false
display: "Billing Address"
- handle: use_shipping_address_for_billing
field:
type: toggle
listable: false
display: "Same Shipping Address?"
default: true
- handle: billing_name
field:
input_type: text
type: text
listable: false
display: "Billing Name"
unless:
use_shipping_address_for_billing: "equals true"
- handle: billing_address
field:
input_type: text
type: text
listable: false
display: "Billing Address Line 1"
width: 50
antlers: false
unless:
use_shipping_address_for_billing: "equals true"
- handle: billing_address_line2
field:
input_type: text
antlers: false
display: "Billing Address Line 2"
type: text
icon: text
width: 50
listable: hidden
unless:
use_shipping_address_for_billing: "equals true"
- handle: billing_city
field:
input_type: text
type: text
listable: false
display: "Billing City"
unless:
use_shipping_address_for_billing: "equals true"
width: 50
- handle: billing_postal_code
field:
input_type: text
type: text
width: 50
listable: false
display: "Billing Postal Code"
unless:
use_shipping_address_for_billing: "equals true"
sidebar:
display: Sidebar
fields:
- handle: paid_date
field:
mode: single
time_enabled: true
time_required: true
earliest_date: "1900-01-01"
full_width: false
inline: false
columns: 1
rows: 1
type: date
display: "Betaaldatum"
validate: required
- handle: items_total
field:
type: money
display: "Bedrag voor boeken"
read_only: true
validate: required
width: 33
listable: hidden
- handle: shipping_total
field:
type: money
display: "Verzendkosten"
read_only: true
validate: required
width: 33
- handle: optional_donation
field:
read_only: true
display: 'Donatiebedrag'
type: money
icon: generic
instructions_position: above
width: 33
- handle: grand_total
field:
type: money
display: "Totaal"
read_only: true
validate: required
width: 33
- handle: avg_savings
field:
read_only: true
display: 'Bespaard'
type: money
icon: generic
instructions_position: above
width: 33
- handle: shipping_method
field:
display: 'Verzendmethode'
type: shipping_method
read_only: true
- handle: ignore_section
field:
type: section
listable: false
display: "Negeer onderstaande"
- handle: coupon_total
field:
type: money
display: "Coupon Total"
read_only: true
validate: required
width: 33
listable: false
visible: false
- handle: tax_total
field:
type: money
display: "BTW"
read_only: true
validate: required
width: 33
listable: false
visible: false
-
handle: purchase_event_saved
field:
default: false
display: Purchase_event_saved
type: toggle
icon: toggle
listable: hidden
instructions_position: above
read_only: false
title: Customers
sections:
main:
display: Main
fields:
- handle: name
field:
input_type: text
type: text
width: 50
display: "Voor- en achternaam"
validate: required
- handle: email
field:
input_type: email
type: text
width: 50
display: Email
validate: required
- handle: orders
field:
create: false
mode: default
resource: orders
display: Orders
type: has_many
icon: has_many
listable: hidden
instructions_position: above
-
handle: optin
field:
default: false
display: Optin
type: toggle
icon: toggle
read_only: false
Released as part of v5.2.1.
Hey Duncan, thank you for checking upon the issues and bringing out fixes. With the latest v5.2.2 release this fixed issue pops up again...
[2023-09-11 09:26:59] local.ERROR: DoubleThreeDigital\Runway\Resource::__construct(): Argument #4 ($blueprint) must be of type Statamic\Fields\Blueprint, null given, called in D:\dev\xampp\nofam-web-peak\vendor\doublethreedigital\runway\src\Runway.php on line 53 {"exception":"[object] (TypeError(code: 0): DoubleThreeDigital\\Runway\\Resource::__construct(): Argument #4 ($blueprint) must be of type Statamic\\Fields\\Blueprint, null given, called in D:\\dev\\xampp\\nofam-web-peak\\vendor\\doublethreedigital\\runway\\src\\Runway.php on line 53 at D:\\dev\\xampp\\nofam-web-peak\\vendor\\doublethreedigital\\runway\\src\\Resource.php:37)
[stacktrace]
#0 D:\\dev\\xampp\\nofam-web-peak\\vendor\\doublethreedigital\\runway\\src\\Runway.php(53): DoubleThreeDigital\\Runway\\Resource->__construct('customers', Object(App\\Models\\CustomerModel), 'Customers', NULL, Array)
#1 D:\\dev\\xampp\\nofam-web-peak\\vendor\\laravel\\framework\\src\\Illuminate\\Collections\\Arr.php(585): DoubleThreeDigital\\Runway\\Runway::DoubleThreeDigital\\Runway\\{closure}(Array, 'App\\\\Models\\\\Cust...')
#2 D:\\dev\\xampp\\nofam-web-peak\\vendor\\laravel\\framework\\src\\Illuminate\\Collections\\Collection.php(825): Illuminate\\Support\\Arr::mapWithKeys(Array, Object(Closure))
#3 D:\\dev\\xampp\\nofam-web-peak\\vendor\\doublethreedigital\\runway\\src\\Runway.php(18): Illuminate\\Support\\Collection->mapWithKeys(Object(Closure))
#4 D:\\dev\\xampp\\nofam-web-peak\\vendor\\doublethreedigital\\runway\\src\\ServiceProvider.php(77): DoubleThreeDigital\\Runway\\Runway::discoverResources()
#5 D:\\dev\\xampp\\nofam-web-peak\\vendor\\statamic\\cms\\src\\Statamic.php(352): DoubleThreeDigital\\Runway\\ServiceProvider->DoubleThreeDigital\\Runway\\{closure}()
#6 D:\\dev\\xampp\\nofam-web-peak\\vendor\\statamic\\cms\\src\\Providers\\AppServiceProvider.php(30): Statamic\\Statamic::runBootedCallbacks()
#7 D:\\dev\\xampp\\nofam-web-peak\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(1053): Statamic\\Providers\\AppServiceProvider->Statamic\\Providers\\{closure}(Object(Illuminate\\Foundation\\Application))
#8 D:\\dev\\xampp\\nofam-web-peak\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(996): Illuminate\\Foundation\\Application->fireAppCallbacks(Array)
#9 D:\\dev\\xampp\\nofam-web-peak\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\BootProviders.php(17): Illuminate\\Foundation\\Application->boot()
#10 D:\\dev\\xampp\\nofam-web-peak\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(261): Illuminate\\Foundation\\Bootstrap\\BootProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#11 D:\\dev\\xampp\\nofam-web-peak\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(447): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#12 D:\\dev\\xampp\\nofam-web-peak\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(199): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#13 D:\\dev\\xampp\\nofam-web-peak\\please(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#14 {main}
"}
My config files are the same as before. Versions used are:
Statamic
Addons: 7
Antlers: regex
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.21.0 PRO
Statamic Addons
doublethreedigital/runway: 5.2.2
doublethreedigital/simple-commerce: 5.3.8
joetannenbaum/antlers-stack-tags: 0.1.0
mitydigital/sitemapamic: 2.3.8
roorda-ict/statamic-entries-export: 2.1.0
statamic/eloquent-driver: 2.6.2
stoffelio/statamic-turnstile: 1.1.0
Which command are you running that causes this error? I'm no longer able to replicate it.
Are you able to share your repository and I can take a further look to prevent going back and forth?
I think I found the issue. Installing it on a (sort of) clean instance led to a lot less issues. There I noticed that my FE was giving errors and this led back to the Peak addon. Researching I found in the Peak docs that it states not to "drive" Blueprints and Fieldsets via Eloquent. Setting this to file solved my issues there.
Trying the same in my instance where this error occurred resulted in the same. E.g. a working instance.
Ps. I understand that this issue disappears with that because it trips particularly over the Blueprint part which is not using Eloquent as the driver anymore. Because of Peak I can't use it anyway, so for me it's okay now.
Ps2. With the SimpleCommerce starter kit you would probably have the same that it shouldn't use, if someone should choose for it, Eloquent as a driver for Blueprints. This since is also uses Peak if I understood correctly.
Glad you can solve it this way @itsmesaskovic. I'm not sure if there's anything I can do on the Peak addon site to remedy this at the moment. It could be referencing fieldsets like this is simply not compatible with Eloquent at the moment. I can't quite remember at this point.
It'll be something on the Runway side. I just need to whip up a fresh site to try and replicate this.
For some reason, I'm currently unable to reproduce it with my current sandbox site.
Is this still an issue for you? I've just spun up a fresh site using Peak and didn't get any Runway errors.
I've not heard back from you in the last couple of weeks and I'm unable to replicate so I'm going to close this issue now.
If you're continuing to run into issues with this, please send me the repository of a site where I can replicate this, thanks!
Sorry for my late response. I haven't been able to reproduce this as well with a new site. Thank you for checking @duncanmcclean.
Description
I have an existing SimpleCommerce setup which is using the database for Order and Customer data via Runway. Now I'm trying to move all other Statamic collections, where products reside as well, over to the database using the Eloquent Driver. Following the commands stated on here I run into the following Runway Exception when I execute this step:
php artisan vendor:publish --provider="Statamic\Eloquent\ServiceProvider" --tag=migrations
Now I'm not sure if this is a Runway issue or Eloquent Driver issue. Since the exception is thrown from Runway I'm posting it here.
Steps to reproduce
Environment
I have to remove the eloquent_driver config file or else I'm not able to run
php please support:details
. Results are: