laravellaraadmin

How to delete s suffix in module from laraadmin (in Module Name and DB table name) - Laravel Project


I have a laraadmin project. But; laraadmin puts the s suffix of module names and module db tables. Example.

I created new module. This module name is : "setting"

if i create module from this name, then the module name becomes the settings.

I want to remove it.(s suffix)


Solution

  • i solved this problem.

    find in project dir :

    ....\vendor\dwij\laraadmin\src\Models\Module.php

    find in this file :

        public static function generateModuleNames($module_name, $icon) {
        $array = array();
        $module_name = trim($module_name);
        $module_name = str_replace(" ", "_", $module_name);
    
        $array['module'] = ucfirst($module_name);               // OLD = $array['module'] = ucfirst(str_plural($module_name));
        $array['label'] = ucfirst($module_name);                // OLD = ucfirst(str_plural($module_name)); 
        $array['table'] = strtolower($module_name);             // OLD = strtolower(str_plural($module_name));
        $array['model'] = ucfirst(str_singular($module_name));
        $array['fa_icon'] = $icon;
        $array['controller'] = $array['module']."Controller";
        $array['singular_l'] = strtolower(str_singular($module_name));
        $array['singular_c'] = ucfirst(str_singular($module_name));
    
        return (object) $array;
    }
    

    get rid of this function : str_plural();