Laraconfig
Laraconfig copied to clipboard
The setting [color] doesn't exist.
hi,
no matter what setting i create, i get the error setting doesn't exist. Laravel Version: 8.61.0 PHP 8
I can see the settings in table, they are enabled. Everything looks ok. Cache is disabled.
this is my user model
...
use DarkGhostHunter\Laraconfig\HasConfig;
class User extends Authenticatable implements LdapAuthenticatable
{
use AuthenticatesWithLdap;
use HasFactory, Notifiable;
use HasLdapUser;
use HasRoles;
use HasConfig;
...
this is the settings/users.php file
<?php
use DarkGhostHunter\Laraconfig\Facades\Setting;
Setting::name('color')->string()->default('black');
This is how i am trying to get it. it always comes blank, even the value exists in database.
$user = User::find(1);
echo "Your color is: {$user->settings->get('color')}.";
if i try to set it i get setting doesn't exists, no matter how i try to set it.
$user = User::find(1);
$setting = $user->settings->get('color');
$setting->value = 'red';
$setting->save();
or
$user->settings->set([
'color' => 'red'
]);
i have investigated more and found out that in database the settable_type is getting saved without slashes.
like: AppModelsUser
it should be App\Models\User
Users already exists in database and the setting is initialized slashes are missing.
Same here. Also see issue #29