PHP function to obtain model_name from Namespace\To\ModelName
You tagged laravel, so this answer assumes you are using Laravel.

Laravel has two built in helper functions that will help you do this. class_basename() will return the name of the class with the namespace stripped off, and snake_case() will convert a string to snake case.

Combine them, and you get:

public function getModelName()
{
    return snake_case(class_basename(__CLASS__));
}