Import entries and terms into Statamic
This is just a note!
I mostly leave these here for my own reference, but if you find this useful that's great. 🙂
# entries$items = [['title' => 'Example 1'],['title' => 'Example 2'],['title' => 'Example 3'],];foreach ($items as $item) {\Statamic\Facades\Entry::make()->published(true)->collection('posts')->blueprint('post')->slug($item['title'])->data($item)->save();}
# entries$items = [['title' => 'Example 1'],['title' => 'Example 2'],['title' => 'Example 3'],];foreach ($items as $item) {\Statamic\Facades\Entry::make()->published(true)->collection('posts')->blueprint('post')->slug($item['title'])->data($item)->save();}
# terms$titles = ['Arts','Food & Drink','History','Shopping','Sport',];foreach ($titles as $title) {\Statamic\Facades\Term::make()->taxonomy('categories')->blueprint('category')->slug($title)->data(['title' => $title,])->save();}
# terms$titles = ['Arts','Food & Drink','History','Shopping','Sport',];foreach ($titles as $title) {\Statamic\Facades\Term::make()->taxonomy('categories')->blueprint('category')->slug($title)->data(['title' => $title,])->save();}