From c8a0a58df620a34e666393447d069fea64604765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sat, 19 Oct 2019 22:03:03 +0200 Subject: [PATCH] Create routes/tenant.php only if the file does not exist (#188) * Create routes/tenant.php only if the file does not exist * Move tenant routes to a stub file --- assets/tenant_routes.php.stub | 16 ++++++++++++++++ src/Commands/Install.php | 27 ++++++--------------------- 2 files changed, 22 insertions(+), 21 deletions(-) create mode 100644 assets/tenant_routes.php.stub diff --git a/assets/tenant_routes.php.stub b/assets/tenant_routes.php.stub new file mode 100644 index 00000000..a51c3f1c --- /dev/null +++ b/assets/tenant_routes.php.stub @@ -0,0 +1,16 @@ +info('✔️ Set middleware priority'); - file_put_contents( - base_path('routes/tenant.php'), - "info('✔️ Created routes/tenant.php'); + if (! file_exists(base_path('routes/tenant.php'))) { + file_put_contents(base_path('routes/tenant.php'), file_get_contents(__DIR__ . '/../../assets/tenant_routes.php.stub')); + $this->info('✔️ Created routes/tenant.php'); + } else { + $this->info('Found routes/tenant.php.'); + } $this->line(''); $this->line('This package lets you store data about tenants either in Redis or in a relational database like MySQL. To store data about tenants in a relational database, you need a few database tables.');