I have installed sepatie/backup
package on my project and configure to create mysql backup. This work when i run php artisan backup:run
. But what i am trying to do is to let user freedom to create backup by clickin on a button. So i have done something like this
Route::get('backup-run', function() {
Artisan::call('backup:run');
return response()->json(['success' => 'Backup for database created']);
});
and a button with vue js method
createDBBackup() {
axios.get('/backup-run')
.then(response => {
on database.php
i have add this config i found on documentation
'dump' => [
'dump_binary_path' => 'C:\xampp\mysql\bin', // only the path, so without `mysqldump` or `pg_dump`
'use_single_transaction',
'timeout' => 60 * 5, // 5 minute timeout
],
as response i get some error like this on clockwork
Spatie\Backup\Events\BackupHasFailed exception: Spatie\DbDumper\Exceptions\DumpFailedbackupDestination: null
exception: Spatie\DbDumper\Exceptions\DumpFailed
*message: "The dump process failed with exitcode 2 : Misuse of shell builtins : mysqldump: Got error: 2004: "Can't create TCP/IP socket (10106)" when trying to connect
"
~string: ""
*code: 0
*file: "C:\...\vendor\spatie\db-dumper\src\Exceptions\DumpFailed.php"
*line: 17
~trace: Array(79)
~previous: null
backupDestination: null