/** * */ public function run() { $categories = $this->category->all(); foreach ($this->posts as $post) { $post['content'] = "Never in all their history have men been able truly to conceive of the world as one: a single sphere, a globe, having the qualities of a globe, a round earth in which all the directions eventually meet, in which there is no center because every point, or none, is center — an equal earth which all men occupy as equals. The airman's earth, if free men make it, will be truly round: a globe in practice, not in theory."; $post['slug'] = Str::slug($post['title']); $post['user_id'] = 1; $post['categories'] = [$categories[mt_rand(0, count($categories) - 1)]['id']]; $this->post->create(1, $post); } }
public function run() { foreach ($this->categories as $category) { $this->category->create($category); } }
/** * Create category * * @param array $data * @return mixed */ public function create(array $data) { $data['type'] = 0; return $this->category->create($data); }