You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.
I can assure you, all the database seeded and migrated properly. I can do dd($user->settings) and it shows me all 3 items. But when I tried to update it using $user->settings->set($key, $value) on for each, it fails with the error
Property [DARK_MODE] does not exist on this collection instance.
at D:\Project\_kevinyobeth\SynchV2\vendor\laravel\framework\src\Illuminate\Collections\Traits\EnumeratesValues.php:912
908▕ */
909▕ public function __get($key)
910▕ {
911▕ if (! in_array($key, static::$proxies)) {
➜ 912▕ throw new Exception("Property [{$key}] does not exist on this collection instance.");
913▕ }
914▕
915▕ return new HigherOrderCollectionProxy($this, $key);
916▕ }
1 D:\Project\_kevinyobeth\SynchV2\vendor\darkghosthunter\laraconfig\src\SettingsCollection.php:326
DarkGhostHunter\Laraconfig\SettingsCollection::__dynamicGet("DARK_MODE")
2 D:\Project\_kevinyobeth\SynchV2\tests\Feature\SettingsTest.php:68
DarkGhostHunter\Laraconfig\SettingsCollection::__get("DARK_MODE")
Update 1
I tried getting the keys from the test, and real browser test, it returns different keys.
When I ran this $user->settings->keys()
Result ["DARK_MODE","SEND_NOTIFICATION_ON_NEW_PROJECT_REQUEST","SEND_NOTIFICATION_ON_NEW_JOB_REQUEST"]
While on the test when I ran it, it returns
Result [0,1,2]
My Workaround
To overcome this problem, I came up with this solution. I search the user setting manually in the controller and it works!
Same issue here.
In my case the problem is that settings:migrate stores settable_type, in user_settings table, to AppModelsUser instead of App\Models\User
The functionality works perfectly on browser. But it keeps failing on feature test.
Here is my controller snippet.
Test Snippet
Test Setup
I can assure you, all the database seeded and migrated properly. I can do
dd($user->settings)
and it shows me all 3 items. But when I tried to update it using$user->settings->set($key, $value)
on for each, it fails with the errorUpdate 1
I tried getting the keys from the test, and real browser test, it returns different keys.
When I ran this
$user->settings->keys()
Result
["DARK_MODE","SEND_NOTIFICATION_ON_NEW_PROJECT_REQUEST","SEND_NOTIFICATION_ON_NEW_JOB_REQUEST"]
While on the test when I ran it, it returns
Result
[0,1,2]
My Workaround
To overcome this problem, I came up with this solution. I search the user setting manually in the controller and it works!
The text was updated successfully, but these errors were encountered: