Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
setiawanhu committed Aug 13, 2020
2 parents 1fb77cb + 84c85b8 commit e094d09
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/Commands/MultiSessionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function handle()
if ($this->option('model')) {
$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?")) {
$this->info('Multi session export aborted.');
return;
Expand Down Expand Up @@ -110,15 +110,10 @@ public function exportModel(string $relation)
public function compileModelStub(string $user)
{
$stub = file_get_contents(__DIR__ . '/stubs/telegram_session.stub');
$namespace = str_replace(
"/" . class_basename($user),
"",
$user
);

return str_replace(
['{{user}}', '{{package}}'],
[Str::snake(class_basename($user)), $namespace],
[Str::snake(class_basename($user)), 'App'],
$stub
);
}
Expand Down

0 comments on commit e094d09

Please sign in to comment.