FAQ - pavel-mironchik/laravel-backup-panel GitHub Wiki

  1. Will support for Laravel 5.5-5.7 be provided?
  2. I still don't understand how to allow access to only a specific user
  3. I want to change styles and use it with my existing admin panel. Is there a way to publish views?
  4. Is there an option to customize view? So it can be fitted in existing application layout with navigation and other stuff.
  5. When I click the "Create Backup" button it creates a backup but I don't see it in the backups table. Is this a bug?

Will support for Laravel 5.5-5.7 be provided?

Unfortunately, not. Laravel Backup Panel uses the spatie/laravel-backup v6 which requires PHP 7.2, with the ZIP module and Laravel 5.8 or higher.

Only the spatie/laravel-backup v5 can work with Laravel 5.5 or higher. But as it is a major version release it will require much more time to support it than to update your project to Laravel 6 (it shouldn't take more than an hour).

Still, if you're sure you can't update and are ready to dedicate your time - feel free to open a PR for Laravel 5 support.

I still don't understand how to allow access to only a specific user

Basically, you just set a constraint in the app/Providers/LaravelBackupPanelServiceProvider.php:

protected function gate()
{
    Gate::define('viewLaravelBackupPanel', function ($user) {
        return in_array($user->email, [
            '[email protected]',
        ]);
    });
}

You provide an administrator's email and that's it. Also, you can implement some other logic there, like:

return $user->hasRole('administrator');

or

return $user->isAdmin;

The $user variable here is currently logged in user, which is the same as \Auth::user() returns.

Here is how I do this personally in my side project: https://github.com/pavel-mironchik/kase-news/blob/master/app/Providers/LaravelBackupPanelServiceProvider.php. I set an administrator's email in the ADMIN_EMAIL variable in .env file and add a related config option to get it anywhere in an application.

I want to change styles and use it with my existing admin panel. Is there a way to publish views?

Version 1

Unfortunately, not. At least for now.

The backup panel that you see in a browser is actually a VueJS single page application, compiled assets. So you just get compiled, minified app.js and app.css files. And I don't see a suitable way to allow users to customize them.

Even if I allow to publish and change CSS styles, then you'll need to compile and place them into the public directory yourself. And when I change something in JavaScript code or CSS - you'll need to figure out what was actually changed and update your custom styles appropriately, just for the fancy look. Is this worth it?

The same approach is used in the Laravel Horizon package and I didn't see anyone requesting a customization feature.

Still, I open to suggestions. If you have an idea of how it could be done - please let me know.

Version 2

You may tune the CSS styles in the public/vendor/laravel_backup_panel directory and change the layout in the resources/views/vendor/laravel_backup_panel directory as you want.

Is there an option to customize view? So it can be fitted in existing application layout with navigation and other stuff.

Version 1

Place an iframe inside your layout, e.g. in a /backupManager route:

<iframe src="/backup" frameborder="0"></iframe>

Then you'll have your layout with navigation working and Laravel Backup Panel will work "on its own" in an iframe.

Version 2

Change the layout in the resources/views/vendor/laravel_backup_panel directory as needed.

When I click the "Create Backup" button it creates a backup but I don't see it in the backups table. Is this a bug?

You have to wait a bit for a backup being created, and then click the "Refresh" button in the backups table's top right corner, manually updating its content.

The reason why it works so is that the backup process uses a job and as it is asynchronous we can't get its result if we don't use polling or sockets.

I don't use polling because a "real-time" update of a backups list isn't such a necessary thing and intensive polling can cause unexpected charges if you use services that require to pay per API requests, such as Google Cloud Storage. Also, some users reported about hitting a rate limit of Dropbox API.

And to use sockets users will need to go through the setup process of Redis and Node.js or some socket library like Laravel Echo and Pusher.

So for now, to see the new backup you have to update the backups table manually.

⚠️ **GitHub.com Fallback** ⚠️