Remove the cast to array
relation as same
public function skills()
{
return $this->hasMany(Skill::class, 'id', 'skills');
}
used the accessor like this
public function getSkillsAttribute($value)
{
$skillIds = json_decode($value, true);
return Skill::whereIn('id', $skillIds)->get();
}