This commit is contained in:
Saeed Vaziry
2025-02-20 18:00:13 +01:00
parent 8c7c3d2192
commit a1cf09e35d
20 changed files with 550 additions and 9 deletions

View File

@ -0,0 +1,29 @@
<?php
namespace App\Cli\Commands\Projects;
use App\Cli\Commands\AbstractCommand;
use App\Models\Project;
use function Laravel\Prompts\table;
class ProjectsListCommand extends AbstractCommand
{
protected $signature = 'projects:list';
protected $description = 'Show projects list';
public function handle(): void
{
$projects = Project::all();
table(
headers: ['ID', 'Name', 'Selected'],
rows: $projects->map(fn (Project $project) => [
$project->id,
$project->name,
$project->id === $this->user()->current_project_id ? 'Yes' : 'No',
])->toArray(),
);
}
}