code: private function resolveModelName($model) {
          if ($model instanceof Controller) {
              $exploded = explode('\\', get_class($model));
              $controllerName = array_pop($exploded);
              return str_singular(str_replace('Controller', '', $controllerName));
          } else if ($model instanceof Eloquent) {
              return get_class($model);
          } else {
              return $model;
          }
      }
docs: Resolves the model name.
  
  @param Controller|Eloquent|String $model An object which represents the model.
  
  @return String the model name.