Repository code in Laravel I am practicing to code in the right way and make it testable. Please review this code and tell me anything bad practices of it.

Entity:

namespace MockBlog\Entities;

use Doctrine\ORM\Mapping as ORM;
//use Doctrine\Common\Collections\ArrayCollection;

/**
* @ORM\Entity
* @ORM\Table(name="mockblog_page")
*/
class Page {

/**
 * @ORM\Id
 * @ORM\GeneratedValue
 * @ORM\Column(type="integer")
 */
protected $id;

/**
 * @ORM\Column(type="string")
 */
protected $title;

/**
 * @ORM\Column(type="string")
 */
protected $slug;

/**
 * @param $title
 */
public function setTitle($title)
{
    $this-&gt;title = $title;
}

/**
 * @param $slug
 */
public function setSlug($slug)
{
    $this-&gt;slug = $slug;
}

/**
 * @return integer
 */
public function getId()
{
    return $this-&gt;id;
}

/**
 * @return string
 */
public function getTitle()
{
    return $this-&gt;title;
}

/**
 * get url of the page
 *
 * @return string
 */
public function getSlug()
{
    return $this-&gt;slug;
}
}


Interface post repository:

interface PostRepository {

/**
 * Find post by the title
 *
 * @param $title
 * @return mixed
 */
public function findByTitle($title);

/**
 * Find post by the url
 *
 * @param $slug
 * @return mixed
 */
public function findBySlug($slug);


/**
 * Find post by user id
 *
 * @param $userId
 * @return mixed
 */
public function findByUserId($userId);

}


Base repository (still blank but i think i will need it later):

class BaseRepository extends EntityRepository  {

}


Base post repository :

abstract class BasePostRepository extends BaseRepository implements PostRepository {

abstract public function save($data, $id);

public function findBySlug($slug)
{
    return $this-&gt;findBy(['slug' =&gt; $slug]);
}

public function findByTitle($title)
{
    return $this-&gt;findBy(['title' =&gt; $title]);
}

public function findByUserId($userId)
{
    return $this-&gt;findBy(['user_id' =&gt; $userId]);
}

}


Doctrine page repository:

class DoctrinePageRepository extends BasePostRepository  {

public function save($data, $id = 0)
{

    $entity = (empty($id)) ? $this-&gt;_class : $this-&gt;find($id);

    $entity-&gt;setTitle($data['title']);
    $entity-&gt;setSlug($data['slug']);

    try{

        EntityManager::persist($entity);
        EntityManager::flush();

        return true;

    } catch (Exception $err){

        return FALSE;

    }
}

}


Service provider:

public function register()
{
    // TODO: Implement register() method.

    $this-&gt;app-&gt;bind(DoctrinePageRepository::class, function($app){
        return new DoctrinePageRepository(
            $app['em'], $app['em']-&gt;getClassMetaData(Page::class)
        );
    });

}
You can merge the methods findBySlug, findByTitle and other findBy methods into one method that accepts parameter field and value

$this-&gt;findBy($field, $title);


And move it in BaseRepository Class. See this article Repository Pattern

so it would look something like this

public function findBy( $field, $value ) {
  return $this-&gt;model-&gt;where($field, $value);
}