Tried to specify the dependencies option of a relationship field but I get this error :
Call to undefined function array_wrap() (View: C:\laragon\www\effigia\vendor\backpack\crud\src\resources\views\crud\fields\relationship\fetch_or_create.blade.php)
field option :
'dependencies' => ['customer_id'],
When I run php artisan backpack:version the output is:
PHP VERSION:
PHP 7.2.11 (cli) (built: Oct 10 2018 02:04:07) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend TechnologiesLARAVEL VERSION:
v7.13.0@6fa69bfbd57744a5bbec5538ce483919b3fd625f
BACKPACK VERSION:
Or I'm just doing it wrong (because I've seen people using this option successfully in other issues) ?
I am sorry @dividy
You are not doing wrong, we did. :hammer:
Laravel helpers were removed but we didn't removed it from fetch.
I am submitting a PR to fix it, meanwhile just replace line 95 of fetch_and_create.blade.php with:
data-dependencies="{{ isset($field['dependencies'])?json_encode(Arr::wrap($field['dependencies'])): json_encode([]) }}"
Best,
Pedro
I fixed it by installing the helpers, because they have been moved to a separate package ?
composer require laravel/helpers
It's one way to do it, but they have been removed by laravel https://laravel-news.com/laravel-5-8-deprecates-string-and-array-helpers
The prefered option now is using the facades Arr:: and Str::
Ofcourse adding the helpers to your composer is a fix, but is one that you should not need when PR gets merged, so it's up to you to have an extra package in your composer.
Best,
Pedro
I like the nice way you say "If you want to be dumb, it's up to you" haha.
Thanks for pointing out the deprecation, I wasn't aware of that and thanks for the quick reply!
Once again when you get this kind of bug... Better Call Pedro!
Haaa it wasn't meant to be "be dumb if you want", it's more like "from our side we are not going to use the helpers, but you can install them and use them wherever you want if that is your preference" hehe
Thanks @dividy :+1:
Oups! Just merged the fix, thanks guys!
Most helpful comment
Haaa it wasn't meant to be "be dumb if you want", it's more like "from our side we are not going to use the helpers, but you can install them and use them wherever you want if that is your preference" hehe
Thanks @dividy :+1: