Example #1
0
 /**
  * Make sure the slug is made up from the title
  */
 public function testSlug()
 {
     $user = factory(User::class)->create();
     $article = new Article();
     $article->setBody('This is the body');
     $article->setTitle('This is the title');
     $article->user()->associate($user);
     $article->setPublished(Article::PUBLISHED);
     $article->setPublishedAt(Carbon::now());
     $article->save();
     $this->assertEquals('this-is-the-title', $article->slug);
 }
 public function includeAuthors(Article $article)
 {
     $user = $article->user()->first();
     return $this->item($user, new UserTransformer());
 }