Example #1
0
 /**
  * Helper method to create a blog post
  * @return object
  */
 public function createBlogPost()
 {
     $faker = Factory::create();
     $title = implode(' ', $faker->words(3));
     $slug = Str::slug($title);
     $data = ['en' => ['title' => $title, 'slug' => $slug, 'content' => $faker->paragraph()], 'fr' => ['title' => $title, 'slug' => $slug, 'content' => $faker->paragraph()], 'category_id' => 1];
     return $this->post->create($data);
 }
Example #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param CreatePostRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(CreatePostRequest $request)
 {
     $this->post->create($request->all());
     flash(trans('blog::messages.post created'));
     return redirect()->route('admin.blog.post.index');
 }