laravelbackupcrmdatabase-backups

How to create backups from user interface CRM?


i am trying to make a backup option for my CRM. I have install this package https://spatie.be/docs/laravel-backup/v5/taking-backups/overview and i am using laravel 6^. I can backup my db and all system configuration with this package if i run backup:run from Terminal but this is not all i want. What i am looking for is to crate an interface where admin of page can make backup manually by clicking on options. For example like this: https://jobclass.laraclassifier.com/admin/backups (email: admin@demosite.com password: 123456) Does any one know how can i do something like this?


Solution

  • Calling Commands Via Code

    Executing an Artisan command outside of the CLI. For example, you may wish to fire an Artisan command from a route or controller. You may use the call method on the Artisan facade to accomplish this. The on your controller you can do this:

    public function createBackup(){
     Artisan::call('backup:run',['--only-db'=>true]);
     /// whatever you want to display
    
    }