1. Go to this page and download the library: Download avcodewizard/laravel-backup library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
avcodewizard / laravel-backup example snippets
return [
'backup_path' => storage_path('backups'),
'keep_days' => 5, // Automatically delete backups older than 5 days
'backup_storage_directory' => false, // true or false
'check_access' => false, // Enable/disable role-based access to UI
'allowed_roles' => [], // Role Names Example: ['Admin', 'Super-Admin','Developer', 'Manager']
];
if (!config('laravelBackup.check_access')) return $next($request);
$user = Auth::user();
if (!$user) {
abort(403, 'Unauthorized - no user authenticated.');
}
if (!method_exists($user, 'hasRole')) {
abort(403, 'User Role Not Implemented!');
}
if (!$user->hasAnyRole(config('laravelBackup.allowed_roles'))) {
abort(403, 'Unauthorized - insufficient permission.');
}
return $next($request);
'backup_storage_directory' => true, // true or false