Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/SharedFolder/AliasesCommand.php
- This file was copied from src/app/Console/Commands/User/AliasesCommand.php.
<?php | <?php | ||||
namespace App\Console\Commands\User; | namespace App\Console\Commands\SharedFolder; | ||||
use App\Console\Command; | use App\Console\Command; | ||||
class AliasesCommand extends Command | class AliasesCommand extends Command | ||||
{ | { | ||||
/** | /** | ||||
* The name and signature of the console command. | * The name and signature of the console command. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $signature = 'user:aliases {user}'; | protected $signature = 'sharedfolder:aliases {folder}'; | ||||
/** | /** | ||||
* The console command description. | * The console command description. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $description = "List a user's aliases"; | protected $description = "List shared folder's aliases"; | ||||
/** | /** | ||||
* Execute the console command. | * Execute the console command. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$user = $this->getUser($this->argument('user')); | $folder = $this->getSharedFolder($this->argument('folder')); | ||||
if (!$user) { | if (!$folder) { | ||||
$this->error("User not found."); | $this->error("Folder not found."); | ||||
return 1; | return 1; | ||||
} | } | ||||
foreach ($user->aliases as $alias) { | foreach ($folder->aliases()->pluck('alias')->all() as $alias) { | ||||
$this->info("{$alias->alias}"); | $this->info($alias); | ||||
} | } | ||||
} | } | ||||
} | } |