O
O
ObehanProger2019-03-11 07:15:00
Laravel
ObehanProger, 2019-03-11 07:15:00

How to replace protected access modifier with public for table eloquent property?

It was necessary to dynamically change the name of the table in the model object, but the protected modifier does not allow this. If this is not possible, what are the workarounds?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2019-03-11
@ObehanProger

If you close your eyes to the obvious reasons why you should not do this, this can be done through a public method setTable($table).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question