Astrotomic / laravel-translatable

A Laravel package for multilingual models
https://docs.astrotomic.info/laravel-translatable/
MIT License
1.22k stars 153 forks source link

Create eloquent #324

Closed StrangerGithuber closed 1 year ago

StrangerGithuber commented 1 year ago

Hi, When I am making a new category then I get error:

Array to string conversion
$result = array_shift($segments);
    831▕
    832▕         foreach ($segments as $segment) {
  ➜ 833▕             $result .= (array_shift($replace) ?? $search).$segment;
    834▕         }
    835▕
    836▕         return $result;
    837▕     }
 Illuminate\Foundation\Bootstrap\HandleExceptions::Illuminate\Foundation\Bootstrap\{closure}("Array to string conversion"
Illuminate\Support\Str::replaceArray("?", "insert into `categories` (`type`, `en`, `updated_at`, `created_at`) values (?, ?, ?, ?)")

Code:

$data1 = [ 'type' => 'Project Category', 'en' => ['name' => 'Application', 'slug' => '/']];
Category::create($data1);

Do I am doing wrong? I checked the documentation and I thought will belike this. If I am doing wrong then how I should do? Thanks in advance the answers.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days