Cleaned up the repositories

This commit is contained in:
Graham Campbell
2015-01-01 18:38:38 +00:00
parent 36b1e1b5d8
commit 670b7b7a73
11 changed files with 313 additions and 57 deletions

View File

@@ -7,17 +7,37 @@ use Component;
class EloquentComponentRepository extends EloquentRepository implements ComponentRepository
{
/**
* The eloquent model instance.
*
* @var \Component
*/
protected $model;
/**
* Create a new eloquent component repository instance.
*
* @param \Component $model
*
* @return void
*/
public function __construct(Component $model)
{
$this->model = $model;
}
public function create($user_id, array $array)
/**
* Create a new model.
*
* @param int $userId
* @param array $data
*
* @return \Illuminate\Database\Eloquent\Model
*/
public function create($userId, array $data)
{
$component = new $this->model($array);
$component->user_id = $user_id;
$component = new $this->model($data);
$component->user_id = $userId;
$this->validate($component);