How can i get model name from model instance. For e.x.
$model=new State;
here, State is model $model is State model instance.
I want to get model name i.e State from $model i.e model instance.
add this method to your State Class
public function getModelName()
{
return __CLASS__;
}
and call it like this:
$model = new State();
echo $model->getModelName();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With