TorchSK said:
You can use $this->model->all()
Many thanks TorchSK,
I haven't access to this static method.
And I think that this part
public function __construct(ModelName $model){
$this->model = $model;
}
belongs to the repository that extends BaseRepository
TorchSK said:
And I think that this part
public function __construct(ModelName $model){ $this->model = $model; }
belongs to the repository that extends BaseRepository
Many thanks TorchSK i will try it.
abstract class BaseRepository {
protected $model;
public function __construct($model = null)
{
$this->model = $model;
}
public function getAll()
{
$this->model->all();
}
public function findById($id)
{
$this->model->find($id);
}
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community