. */ namespace App\Console\Commands; use Illuminate\Console\Command; use App\Account; use App\Admin; class SetAccountAdmin extends Command { protected $signature = 'accounts:set-admin {id}'; protected $description = 'Give the admin role to an account'; public function __construct() { parent::__construct(); } public function handle() { $account = Account::where('id', $this->argument('id'))->first(); if (!$account) $this->error('Account not found, please use an existing ID'); $admin = new Admin; $admin->account_id = $account->id; $admin->save(); } }