vendor/laravel/framework/src/Illuminate/Foundation/Console/PolicyMakeCommand.php
/**
     * Replace the model for the given stub.
     *
     * @param  string  $stub
     * @param  string  $model
     * @return string
     */
Replace the model for the given stub.
Replace the model for the given stub .
protected function replaceModel($stub, $model)
    {
        $model = str_replace('/', '\\', $model);
        $namespaceModel = $this->laravel->getNamespace().$model;
        if (Str::startsWith($model, '\\')) {
            $stub = str_replace('NamespacedDummyModel', trim($model, '\\'), $stub);
        } else {
            $stub = str_replace('NamespacedDummyModel', $namespaceModel, $stub);
        }
        $stub = str_replace(
            "use {$namespaceModel};\nuse {$namespaceModel};", "use {$namespaceModel};", $stub
        );
        $model = class_basename(trim($model, '\\'));
        $stub = str_replace('DummyModel', $model, $stub);
        $stub = str_replace('dummyModel', Str::camel($model), $stub);
        return str_replace('dummyPluralModel', Str::plural(Str::camel($model)), $stub);
    }
protected function replaceModel ( $ stub , $ model ) { $ model = str_replace ( '/' , '\\' , $ model ) ; $ namespaceModel = $ this -> laravel -> getNamespace ( ) . $ model ; if ( Str :: startsWith ( $ model , '\\' ) ) { $ stub = str_replace ( 'NamespacedDummyModel' , trim ( $ model , '\\' ) , $ stub ) ; } else { $ stub = str_replace ( 'NamespacedDummyModel' , $ namespaceModel , $ stub ) ; } $ stub = str_replace ( " use  { $ namespaceModel } ; \n use  { $ namespaceModel } ; " , " use  { $ namespaceModel } ; " , $ stub ) ; $ model = class_basename ( trim ( $ model , '\\' ) ) ; $ stub = str_replace ( 'DummyModel' , $ model , $ stub ) ; $ stub = str_replace ( 'dummyModel' , Str :: camel ( $ model ) , $ stub ) ; return str_replace ( 'dummyPluralModel' , Str :: plural ( Str :: camel ( $ model ) ) , $ stub ) ; }
Replace the model for the given stub.
Replace the model for the given stub .