How can I pass, or otherwise "infer" the model of a child controller from within a parent controller using Laravel 5.1? I need this functionality as I'm adding a generic method in my parent controller which all children can use.
I've tried passing and inferring with 500
errors.
Child Controller:
use App\UserQuestion;
class UserQuestions extends ResourceController
{
$this->parentMethod($input, UserQuestion);
}
Parent Controller:
class ResourceController extends Controller
{
protected function parentMethod($input, Model $model)
{
$childTableName = $model->getTable();
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire