diff --git a/src/Commands/DomainControllerMakeCommand.php b/src/Commands/DomainControllerMakeCommand.php index cab4763..2e50e0f 100644 --- a/src/Commands/DomainControllerMakeCommand.php +++ b/src/Commands/DomainControllerMakeCommand.php @@ -64,7 +64,7 @@ protected function buildClass($name) $replace = []; $appRootNamespace = $this->laravel->getNamespace(); - $pathToAppBaseController = parent::getPath("Http\Controllers\Controller"); + $pathToAppBaseController = app_path('Http/Controllers/Controller.php'); $baseControllerExists = $this->files->exists($pathToAppBaseController); diff --git a/tests/Generator/ControllerMakeTest.php b/tests/Generator/ControllerMakeTest.php index 3bf0448..1fb74cf 100644 --- a/tests/Generator/ControllerMakeTest.php +++ b/tests/Generator/ControllerMakeTest.php @@ -41,15 +41,8 @@ expect($contents) ->toContain("namespace {$expectedNamespace};") - ->toContain("use App\Http\Controllers\Controller;") + ->toContain("use App\Http\Controllers\Controller;".PHP_EOL."use Illuminate\Http\Request;") ->toContain('extends Controller'); - - // if (Feature::Laravel11->exists()) { - // // These assertions don't seem to pass on Laravel 10 - // expect($contents) - // ->toContain("use App\Http\Controllers\Controller;") - // ->toContain('extends Controller'); - // } })->with([ 'Invoicing:InvoiceController' => [ 'Invoicing', @@ -232,12 +225,9 @@ expect($contents = file_get_contents($expectedPath)) ->toContain("namespace {$expectedNamespace};"); - if (Feature::Laravel11->exists()) { - // These assertions don't seem to pass on Laravel 10 - expect($contents) - ->not->toContain("use App\Http\Controllers\Controller;") - ->not->toContain('extends Controller'); - } + expect($contents) + ->not->toContain("use App\Http\Controllers\Controller;") + ->not->toContain('extends Controller'); })->with([ 'Invoicing:InvoiceController' => [ 'Invoicing',