Merge branch 'dev'

This commit is contained in:
Setiawan Hu 2020-08-13 23:12:56 +07:00
commit e094d091c0

View File

@ -43,7 +43,7 @@ class MultiSessionCommand extends Command
if ($this->option('model')) { if ($this->option('model')) {
$user = $this->ask('Telegram user model (for relation)', 'App/User'); $user = $this->ask('Telegram user model (for relation)', 'App/User');
if (file_exists(app_path()) && !$this->option('force')) { if (file_exists(app_path("TelegramSession.php")) && !$this->option('force')) {
if (!$this->confirm("The App/TelegramSession model is already exist. Replace it?")) { if (!$this->confirm("The App/TelegramSession model is already exist. Replace it?")) {
$this->info('Multi session export aborted.'); $this->info('Multi session export aborted.');
return; return;
@ -110,15 +110,10 @@ class MultiSessionCommand extends Command
public function compileModelStub(string $user) public function compileModelStub(string $user)
{ {
$stub = file_get_contents(__DIR__ . '/stubs/telegram_session.stub'); $stub = file_get_contents(__DIR__ . '/stubs/telegram_session.stub');
$namespace = str_replace(
"/" . class_basename($user),
"",
$user
);
return str_replace( return str_replace(
['{{user}}', '{{package}}'], ['{{user}}', '{{package}}'],
[Str::snake(class_basename($user)), $namespace], [Str::snake(class_basename($user)), 'App'],
$stub $stub
); );
} }