I extend a controller that has a method:
show($id){
//do something
}
In my extended controller I override the show method:
show($id){
//do something else
}
How can I call the show method on the parent controller?
show($id){
if($id == 1) //go to show method on parent controller
}
This should work:
Class BaseController {
protected function show($id){
return "Test Succeeded";
}
}
Class MyController extends BaseController {
public function show($id){
if($id == 1){
parent::show($id);
}
}
}
echo (new MyController())->show(1); //Returns Test Succeeded