1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 19:14:03 +00:00

Update MigrateFreshOverride

This commit is contained in:
lukinovec 2022-10-14 13:48:49 +02:00
parent 5fa50cdd49
commit 987ac9a347

View file

@ -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();
}