roiLeo /
laravel-saml2
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Slides\Saml2\Commands; |
||
| 4 | |||
| 5 | use Slides\Saml2\Helpers\ConsoleHelper; |
||
| 6 | use Slides\Saml2\Repositories\TenantRepository; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Class TenantCredentials |
||
| 10 | * |
||
| 11 | * @package Slides\Saml2\Commands |
||
| 12 | */ |
||
| 13 | class TenantCredentials extends \Illuminate\Console\Command |
||
| 14 | { |
||
| 15 | use RendersTenants; |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 16 | |||
| 17 | /** |
||
| 18 | * The name and signature of the console command. |
||
| 19 | * |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | protected $signature = 'saml2:tenant-credentials {id}'; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * The console command description. |
||
| 26 | * |
||
| 27 | * @var string |
||
| 28 | */ |
||
| 29 | protected $description = 'List tenant credentials for IdP'; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var TenantRepository |
||
| 33 | */ |
||
| 34 | protected $tenants; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * DeleteTenant constructor. |
||
| 38 | * |
||
| 39 | * @param TenantRepository $tenants |
||
| 40 | */ |
||
| 41 | public function __construct(TenantRepository $tenants) |
||
| 42 | { |
||
| 43 | $this->tenants = $tenants; |
||
| 44 | |||
| 45 | parent::__construct(); |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Execute the console command. |
||
| 50 | * |
||
| 51 | * @return void |
||
| 52 | */ |
||
| 53 | public function handle() |
||
| 54 | { |
||
| 55 | if(!$tenant = $this->tenants->findById($this->argument('id'))) { |
||
| 56 | $this->error('Cannot find a tenant #' . $this->argument('id')); |
||
| 57 | return; |
||
| 58 | } |
||
| 59 | |||
| 60 | $this->renderTenants($tenant, 'The tenant model'); |
||
| 61 | $this->renderTenantCredentials($tenant); |
||
| 62 | |||
| 63 | $this->output->newLine(); |
||
| 64 | } |
||
| 65 | } |