Commit 8402aaaf authored by Abdel Nalbou's avatar Abdel Nalbou

created Repository Interface

 + implements it in AbstractCoreRepository
parent 92a92804
<?php namespace Modules\Core\Repositories;
interface CoreRepository
{
public function find($id);
public function all();
public function add($data);
public function remove($ids);
}
<?php namespace Modules\Core\Repositories\Eloquent;
use Illuminate\Database\Eloquent\Model;
use Modules\Core\Repositories\CoreRepository;
abstract class EloquentCoreRepository implements CoreRepository
{
protected $model;
public function __construct(Model $model)
{
$this->model = $model;
}
public function find($id)
{
return $this->model->find($id);
}
public function all()
{
return $this->model->all();
}
public function add($data)
{
return $this->model->create($data);
}
public function remove($ids)
{
return $this->model->destroy($ids);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment