public function createNewBackup()
 {
     $dir = substr(__DIR__, 0, 24) . 'database/backups/';
     $newBackup = Backup::create();
     $command = '/opt/lampp/bin/mysqldump -uroot lions > ' . $dir . $newBackup->getDateTimeString() . '.sql';
     exec($command);
 }
 public function store()
 {
     if (!Auth::check()) {
         return response()->json($this->notLoginJson, 401);
     } else {
         $user = Auth::user();
         if (!$user->hasRole('admin')) {
             return response()->json($this->needPermissionsJson, 401);
         }
     }
     $dir = substr(__DIR__, 0, 24) . 'database/backups/';
     $newBackup = Backup::create();
     $command = '/opt/lampp/bin/mysqldump -uroot lions > ' . $dir . $newBackup->getDateTimeString() . '.sql';
     exec($command);
     return response()->json(['message' => 'Backup success!']);
 }