New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ErrorException array_merge(): Argument #1 is not an array when saving a model Laravel 5.4 #389
Comments
I have the same problem. Any fix? |
It's not pretty but you can temporarily comment out that line (SlugService.php line 67) to resolve the error. I'm going to trouble shoot the issue further and will report back when I find the source of the issue/better solution. line 67 |
I've commented that line, but now another error occurs: at HandleExceptions->handleError(4096, 'Argument 2 passed to Cviebrock\EloquentSluggable\Services\SlugService::buildSlug() must be of the type array, null given, called in /home/userl/public_html/laravel/vendor/cviebrock/eloquent-sluggable/src/Services/SlugService.php on line 41 and defined', '/home/user/public_html/laravel/vendor/cviebrock/eloquent-sluggable/src/Services/SlugService.php', 76, array('attribute' => 'slug')) |
Did you publish the default configuration file? |
I've published now the configuration file, but on saving the content I'm receiving this error: |
Do you mind adding |
I've added
I'm saving the content successfully, but without using the slug. |
So far, every report of the You are saying that adding Or, maybe easier: can you try the |
I've deleted all the files related with sluggable, installed it again with composer and it's still the same...will do some research when I have time. Laravel 5.4 |
The config doesn't publish automagically. You'll need to do that with: php artisan vendor:publish --provider="Cviebrock\EloquentSluggable\ServiceProvider" |
I've already tried that too. |
I also just got this error on a brand new install of the plugin. (Laravel 5.4) It appears there are no defaults defined in the code. The documentation says:
I tried publishing the configuration file using the command given but I didn't see a new file created or any I had to manually copy the There appear to be two problems here:
|
I can confirm that the publish command is not working and that's why is not generating the @aaronpk Something to add: to retrieve the slug method, the controller has to have this function The documentation of this plugin should be changed. So, the method for fetching the specific post looks like this in my case:
|
I can not duplicate this on a fresh Laravel 5.4 install. composer create-project --prefer-dist laravel/laravel:~5.4.0 test54
cd test54
composer require cviebrock/eloquent-sluggable:^4.2
nano config/app.php
php artisan vendor:publish --provider="Cviebrock\EloquentSluggable\ServiceProvider" (The After running all those lines, the default configuration is copied from the package to If you can submit some reproducible code I can run to debug, I'll take a look. |
That
Following those instructions, the configuration file is not published.
No configuration file is created. After adding
I would recommend updating the installation docs to say that adding the service provider to the |
The docs you read are for the The docs in the Laravel 5.4 version (i.e. package version 4.2.x) say that you'll need to register the provider manually. |
That said, I will update the docs for the recent version to provide a link back to the old docs, just so it's obvious. This is a bit of a drawback of github always showing the latest version of README.md by default. :) |
ah that makes sense, I didn't even think to look at another branch on github. A link to the previous version would be very helpful! |
Try to make sure sluggable.php file is there at app/config. I have faced the same as config file didn't created and I have to make it manually! |
I had the same problem, it got solved by 2 steps
Thanks |
I had the same problem, |
I have the same problem today. I believe it is because I have used a [space] in the array key name. I have done it this way, because it maps to an HTML -> OPTGROUP and gives me the display value wanted - is there an easy way around this? The main issue is that I want a single array for each sub-category and then merge the required parts to give different outputs in different parts - purely to keep the "app.config" file lean. I'd be grateful of any ideas before i scrap it and make an array for each purpose (not really ideal) -- EDIT -- For further info, The only actual time i encounter an error (at the moment) is in migration But it may exist in other places if I've made a noob error |
adding the following line to the providers array in config/app.php solved the issue.
Also without adding this line to the config/app.php file the artisan command to publish default configuration file won't work. I don't think this is an issue but just wanted to inform this to anyone who might be stuck in the same issue in the future. Still today, I couldn't find the docs for v4.2.* which was for Laravel 5.4.*. Please update docs with links to docs for older version of the package. |
I upgraded a Laravel app from 4.2 to 5.4 that was using eloquent-sluggable. I setup a fresh Laravel app and migrated over the controllers, views, etc. I'm having an issue with eloquent-sluggable.
I followed the E-S upgrade guide and updated the Models to the latest recommendations.
I get this error when eloquent is saving a model.
[2017-09-13 22:44:28] local.ERROR: ErrorException: array_merge(): Argument #1 is not an array in /Users/underwood/code/valet/project/vendor/cviebrock/eloquent-sluggable/src/Services/SlugService.php:65
App is L5.4, PHP 7
cviebrock/eloquent-sluggable 4.2.5
The text was updated successfully, but these errors were encountered: