in app/Console/Commands/ImportVCards.php [37:72]
public function handle(Filesystem $filesystem)
{
$email = $this->option('user');
// if no email was passed to the option, prompt the user to enter the email
if (! $email) {
$email = $this->ask('what is the user\'s email?');
}
// retrieve the user with the specified email
$user = User::where('email', $email)->first();
if (! $user) {
// show an error and exist if the user does not exist
$this->error('No user with that email.');
return;
}
$path = $this->option('path');
// if no email was passed to the option, prompt the user to enter the email
if (! $path) {
$path = $this->ask('what file you want to import?');
}
if (! $filesystem->exists($path) || ! $this->acceptedExtensions($filesystem, $path)) {
$this->error('The provided vcard file was not found or is not valid!');
return;
}
$importJob = $this->import($path, $user);
return $this->report($importJob) ? 0 : 1;
}