I created an intermediate class between models and, actually, Model .
class Transaction extends BaseModel abstract class BaseModel extends Model In the BaseModel class BaseModel I added the getClass() method
protected function getClass($short = false) { $namespace = get_called_class(); if ($short) { $className = explode('\\', $namespace); $className = end($className); } else { $className = $namespace; } return $className; } Then I got an object of the Transaction model from the collection and try to call getClass()
As a result, the following error occurs:
ErrorException in Builder.php line 2345: Call to undefined method Illuminate \ Database \ Query \ Builder :: getClass ()
Question: Why do I get an error from the builder when I try to call the model method and how can I fix it?
getClassmethod on another class.Illuminate\Database\Query\Builder- E_p