public function writeEntry($title, $url, $description, $author = null, $taxonomies = array(), $collection = null) { if (!$collection) { $collection = $this->getConfig('collection'); } $entry = Entry::create(Str::slug($title))->collection($collection)->order($this->getOrderPrefix($collection))->get(); $entry->set('title', $title); if ($url) { $entry->set('link', $url); } // read default author if not passed in if (!$author) { $author = $this->getConfig('author'); } $entry->set('author', User::whereUsername($author)->id()); foreach ($taxonomies as $taxonomy => $terms) { if ($terms != null) { $entry->set($taxonomy, $this->getTermIds($taxonomy, $terms)); } } $entry->content($description); $entry->save(); // there may be UTF-8 spaces still left and I have no idea how to get rid of them // properly so this is an ugly hack // $slug = str_replace("%C2%A0","-", urlencode($slug)); }