I'm using the laravel-mongodb library ( https://github.com/jenssegers/laravel-mongodb )
When I want to create a new record, i get this error:
strlen() expects parameter 1 to be string, array given
in project.local/vendor/mongodb/mongodb/src/Collection.php:104
This is the Model: Category.php
namespace App\Models;
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
class Category extends Eloquent
{
protected $collection = [ 'categories' ];
protected $fillable = [ 'name', 'parentId' ];
}
And this is my store method:
public function store(Request $request)
{
// e1: Category::create([ 'name' => 'T-shirts' ]);
$n = new Category;
$n->name = 'T-shirts';
$n->save();
return back();
}