classes/Helpers.php
public function modelForController($controller)
    {
        // Swap out the namespace if decoy
        $model = str_replace('Bkwld\Decoy\Controllers',
            'Bkwld\Decoy\Models',
            $controller,
            $is_decoy);

        // Replace non-decoy controller's with the standard model namespace
        if (!$is_decoy) {
            $namespace = ucfirst(Config::get('decoy.core.dir'));
            $model = str_replace('App\Http\Controllers\\'.$namespace.'\\', 'App\\', $model);
        }

        // Make it singular
        $offset = strrpos($model, '\\') + 1;

        return substr($model, 0, $offset).Str::singular(substr($model, $offset));
    }
public function modelForController($controller)
    {
        // Swap out the namespace if decoy
        $model = str_replace('Bkwld\Decoy\Controllers',
            'Bkwld\Decoy\Models',
            $controller,
            $is_decoy);

        // Replace non-decoy controller's with the standard model namespace
        if (!$is_decoy) {
            $namespace = ucfirst(Config::get('decoy.core.dir'));
            $model = str_replace('App\Http\Controllers\\'.$namespace.'\\', 'App\\', $model);
        }

        // Make it singular
        $offset = strrpos($model, '\\') + 1;

        return substr($model, 0, $offset).Str::singular(substr($model, $offset));
    }
public function modelForController ( $ controller ) { // Swap out the namespace if decoy $ model = str_replace ( 'Bkwld\Decoy\Controllers' , 'Bkwld\Decoy\Models' , $ controller , $ is_decoy ) ; // Replace non-decoy controller's with the standard model namespace if ( ! $ is_decoy ) { $ namespace = ucfirst ( Config :: get ( 'decoy.core.dir' ) ) ; $ model = str_replace ( 'App\Http\Controllers\\' . $ namespace . '\\' , 'App\\' , $ model ) ; } // Make it singular $ offset = strrpos ( $ model , '\\' ) + 1 ; return substr ( $ model , 0 , $ offset ) . Str :: singular ( substr ( $ model , $ offset ) ) ; }
Get the model class string from a controller class string

@param  string $controller ex: "App\Http\Controllers\Admin\People"
@return string ex: "App\Person"
Get the model class string from a controller class string