mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 19:14:03 +00:00
Update MigrateFreshOverride
This commit is contained in:
parent
5fa50cdd49
commit
987ac9a347
1 changed files with 8 additions and 2 deletions
|
|
@ -5,13 +5,19 @@ declare(strict_types=1);
|
|||
namespace Stancl\Tenancy\Commands;
|
||||
|
||||
use Illuminate\Database\Console\Migrations\FreshCommand;
|
||||
use Stancl\Tenancy\Database\Contracts\TenantWithDatabase;
|
||||
|
||||
class MigrateFreshOverride extends FreshCommand
|
||||
{
|
||||
public function handle()
|
||||
{
|
||||
dd('overriden');
|
||||
tenancy()->model()::all()->each->delete();
|
||||
tenancy()->model()::all()->each(function(TenantWithDatabase $tenant) {
|
||||
if (method_exists($tenant, 'domains')) {
|
||||
$tenant->domains()->delete();
|
||||
}
|
||||
|
||||
$tenant->delete();
|
||||
});
|
||||
|
||||
return parent::handle();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue