-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a49ec02
commit 8f2db60
Showing
4 changed files
with
163 additions
and
28 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
web/Modules/Customer/App/Console/GitRepositoryMarkAsPulled.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace Modules\Customer\App\Console; | ||
|
||
use App\Models\GitRepository; | ||
use Illuminate\Console\Command; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
||
class GitRepositoryMarkAsPulled extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
*/ | ||
protected $signature = 'git-repository:mark-as-pulled {id}'; | ||
|
||
/** | ||
* The console command description. | ||
*/ | ||
protected $description = 'Command description.'; | ||
|
||
/** | ||
* Create a new command instance. | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
*/ | ||
public function handle() | ||
{ | ||
$id = $this->argument('id'); | ||
|
||
$repository = GitRepository::find($id); | ||
if (!$repository) { | ||
$this->error('Repository not found.'); | ||
return; | ||
} | ||
|
||
$repository->status = GitRepository::STATUS_UP_TO_DATE; | ||
$repository->save(); | ||
} | ||
|
||
/** | ||
* Get the console command arguments. | ||
*/ | ||
protected function getArguments(): array | ||
{ | ||
return [ | ||
['id', InputArgument::REQUIRED, 'Git repository ID.'], | ||
]; | ||
} | ||
|
||
/** | ||
* Get the console command options. | ||
*/ | ||
protected function getOptions(): array | ||
{ | ||
return [ | ||
['example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters