Laravel - Repository and Entity patterns I've spent quite a bit of time studying the repository and entity patterns and this is what I came up with. I would appreciate it if you could post suggestions and critique.

User entity:

&lt;?php
    namespace App\Entities\Entities\User;

    use
    App\Entities\Abstracts\AbstractEntity,
    App\Repositories\Interfaces\UserRepositoryInterface as UserRepository,
    App\Services\Validation\Laravel\UserLoginValidator,
    Str,
    Exception,
    ExceptionHandler,
    stdClass,
    MessageBag;

    class UserEntity extends AbstractEntity
    {
        protected $loginValidator;

        public function __construct(
            UserRepository $repository
            UserLoginValidator $loginValidator
            )
        {
            $this-&gt;repository = $repository;
            $this-&gt;loginValidator = $loginValidator;
        }


        public function login(array $input)
        {
            $result = $this-&gt;validate($this-&gt;loginValidator, $input);
            if(!$result instanceof MessageBag)
            {
                try
                {
                    $user = $this-&gt;repository-&gt;authenticate(array(
                        'email'     =&gt;  $input['email'],
                        'password'  =&gt;  $input['password']
                        ), false);
                    $this-&gt;save($user);
                    $user-&gt;type = $user-&gt;getGroups()[0]-&gt;id;

                    $result = new stdClass;
                    $result-&gt;errors = false;
                    $result-&gt;status_code = 23;
                    $result-&gt;user = $user-&gt;toArray();
                    return $result;
                }
                catch (Exception $e)
                {
                    return ExceptionHandler::returnException($e);
                }
            }
            else
                return $this-&gt;loginValidator-&gt;returnErrors();
        }

    }


User Repository:

&lt;?php

    namespace App\Repositories\Eloquent\User;

    use
    App\Repositories\Abstracts\AbstractRepository,
    App\Repositories\Interfaces\UserRepositoryInterface,
    Cartalyst\Sentry\Sentry as Sentry,
    Cartalyst\Sentry\Users\Eloquent\User as SentryUser;

    class EloquentUserRepository extends AbstractRepository implements UserRepositoryInterface
    {
        public function __construct(Sentry $model)
        {
            $this-&gt;model = $model;
        }

        public function find($id)
        {
            return $this-&gt;model-&gt;findUserById($id);
        }

        public function save(SentryUser $model)
        {
            return $model-&gt;save();
        }

        public function getAccessToken()
        {
            return $this-&gt;model-&gt;getUser()-&gt;access_token;
        }
    }
?&gt;


User controller:

&lt;?php
    namespace Controllers\API;
    use
    BaseController,
    Input,
    ResponseSender,
    App\Entities\Entities\User\UserEntity;

    class UserController extends BaseController
    {
        protected $user;

        public function __construct(UserEntity $user)
        {
            $this-&gt;user = $user;
        }

        public function postLogin()
        {
            return ResponseSender::send($this-&gt;user-&gt;login(Input::all()));
        }

    }
?&gt;
Maybe I'm just thinking of a different approach, but I normally would've reversed the dependency between UserEntity and UserRepository.  I would expect the UserEntity to represent a singular record in the database and that I would use the UserRepository to retrieve one.

In this case, I would inject the UserRepository into the controller and call UserRepository.Login(userId, password) that would actually perform the lookup against the DB and return a UserEntity representing the logged in user.

Also, I would suggest defining interfaces for your injected classes so that it's easier to provide future implementations