Closed lgt closed 10 years ago
getAll is a base method.
So in your repository you would simply do
public function getAll()
{
return $this->model->where(‘id’,$id)->get();
}
I can’t see where you’d want $id defined though.
Additionally with the base-repository commands you could probably just do
public function getAll()
{
return $this->getById($id);
}
Hope that helps!
Dave
Thanks for your fast reaction. I pass the ID via url like /propertyrooms/1 where 1 is the the ID of the referenced property, and would be good to know how to catch that id if in the router I have
Route::controller( $urlSegment.'/rooms/{id}' , 'Davzie\LaravelBootstrap\Controllers\RoomsController' );
. I will give another try with your advised and thank you for your feedback
So I've been following the patterns and I made a custom Class, Interface and on getAll I would like to override the query like
return $this->model->where('id',$id)->get();
How would I do that?