Skip to content

Commit 8e16b0b

Browse files
committed
Setup backup
1 parent c351dad commit 8e16b0b

File tree

8 files changed

+50
-878
lines changed

8 files changed

+50
-878
lines changed

.phpstorm.meta.php

Lines changed: 4 additions & 192 deletions
Large diffs are not rendered by default.

_ide_helper.php

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -22407,49 +22407,6 @@ public static function flushMacros()
2240722407
}
2240822408
}
2240922409

22410-
namespace Spatie\SignalAwareCommand\Facades {
22411-
/**
22412-
*
22413-
*
22414-
* @see \Spatie\SignalAwareCommand\Signal
22415-
*/
22416-
class Signal {
22417-
/**
22418-
*
22419-
*
22420-
* @static
22421-
*/
22422-
public static function handle($signal, $callable)
22423-
{
22424-
/** @var \Spatie\SignalAwareCommand\Signal $instance */
22425-
return $instance->handle($signal, $callable);
22426-
}
22427-
22428-
/**
22429-
*
22430-
*
22431-
* @static
22432-
*/
22433-
public static function executeSignalHandlers($signal, $command)
22434-
{
22435-
/** @var \Spatie\SignalAwareCommand\Signal $instance */
22436-
return $instance->executeSignalHandlers($signal, $command);
22437-
}
22438-
22439-
/**
22440-
*
22441-
*
22442-
* @static
22443-
*/
22444-
public static function clearHandlers($signal = null)
22445-
{
22446-
/** @var \Spatie\SignalAwareCommand\Signal $instance */
22447-
return $instance->clearHandlers($signal);
22448-
}
22449-
22450-
}
22451-
}
22452-
2245322410
namespace Illuminate\Http {
2245422411
/**
2245522412
*
@@ -27282,7 +27239,6 @@ class Uri extends \Illuminate\Support\Uri {}
2728227239
class Validator extends \Illuminate\Support\Facades\Validator {}
2728327240
class View extends \Illuminate\Support\Facades\View {}
2728427241
class Vite extends \Illuminate\Support\Facades\Vite {}
27285-
class Signal extends \Spatie\SignalAwareCommand\Facades\Signal {}
2728627242
}
2728727243

2728827244

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Console\Commands;
6+
7+
use Illuminate\Console\Command;
8+
use Illuminate\Support\Facades\File;
9+
10+
final class PerformDatabaseBackupCommand extends Command
11+
{
12+
/**
13+
* The name and signature of the console command.
14+
*
15+
* @var string
16+
*/
17+
protected $signature = 'perform:database-backup';
18+
19+
/**
20+
* The console command description.
21+
*
22+
* @var string
23+
*/
24+
protected $description = 'Perform a database backup.';
25+
26+
/**
27+
* Execute the console command.
28+
*/
29+
public function handle(): void
30+
{
31+
$filename = 'backup-'.now()->timestamp.'.sql';
32+
33+
File::copy(database_path('database.sqlite'), database_path('backups/'.$filename));
34+
35+
$glob = File::glob(database_path('backups/*.sql'));
36+
37+
collect($glob)->sort()->reverse()->slice(4)->filter(
38+
fn (mixed $backup): bool => is_string($backup),
39+
)
40+
->each(
41+
fn (string $backup): bool => File::delete($backup),
42+
);
43+
}
44+
}

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"inertiajs/inertia-laravel": "^2.0",
1414
"laravel/framework": "^12.0",
1515
"laravel/tinker": "^2.10.1",
16-
"spatie/laravel-backup": "^9.2",
1716
"spatie/laravel-honeypot": "^4.5",
1817
"tightenco/ziggy": "^2.4"
1918
},

0 commit comments

Comments
 (0)