Файловый менеджер - Редактировать - /home/clickysoft/public_html/assets.clickysoft.net/app/Console/Commands/MakeRepository.php
Назад
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\File; class MakeRepository extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'make:repository {name}'; /** * The console command description. * * @var string */ protected $description = 'Create a repository and its interface'; /** * Execute the console command. */ public function handle() { $name = $this->argument('name'); $directoryPath = app_path('Repositories'); $interfacePath = "{$directoryPath}/{$name}RepositoryInterface.php"; $repositoryPath = "{$directoryPath}/{$name}Repository.php"; // Create the Repositories directory if it doesn't exist if (!File::isDirectory($directoryPath)) { File::makeDirectory($directoryPath, 0755, true); $this->info("Created directory: {$directoryPath}"); } // Create the interface if (!File::exists($interfacePath)) { File::put($interfacePath, "<?php\n\nnamespace App\Repositories;\n\ninterface {$name}RepositoryInterface\n{\n // Define methods\n}\n"); $this->info("Created Interface: {$interfacePath}"); } else { $this->error("Interface already exists: {$interfacePath}"); } // Create the repository if (!File::exists($repositoryPath)) { File::put($repositoryPath, "<?php\n\nnamespace App\Repositories;\n\nclass {$name}Repository implements {$name}RepositoryInterface\n{\n // Implement methods\n}\n"); $this->info("Created Repository: {$repositoryPath}"); } else { $this->error("Repository already exists: {$repositoryPath}"); } } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка