author() public method

Relation to Author model.
public author ( ) : BelongsTo
return Illuminate\Database\Eloquent\Relations\BelongsTo
 /**
  * Test generating slug from related model field.
  *
  * @test
  */
 public function testSlugFromRelatedModel()
 {
     $author = Author::create(['name' => 'Arthur Conan Doyle']);
     $post = new PostWithRelation(['title' => 'First']);
     $post->author()->associate($author);
     $post->save();
     $this->assertEquals('arthur-conan-doyle-first', $post->slug);
 }