We have to define the access modifier for that class property.
For table use :- protected $table = "users"
You may define the primary key field name for your table so model will known for that.
protected $primaryKey = "code";
If you model has non-integer data type primary key field then you have to define these below in model
Example : In you model has code is primary key so according to it is string datatype so you have define that as given below example.
2
Answers
the
$table
variable is a class property, and class properties needs to be defined with their visibility as a prefix (public
,protected
orprivate
).In this particular case, the
$table
property is already define on theModel
, so we know it’s visibility, it’sprotected
.We have to define the access modifier for that class property.
For table use :-
protected $table = "users"
You may define the primary key field name for your table so model will known for that.
If you model has non-integer data type primary key field then you have to define these below in model
Example : In you model has code is primary key so according to it is string datatype so you have define that as given below example.