Пример #1
0
 /**
  * Reset database by truncating tables and re-seeding.
  * 
  * @return Response
  */
 public function reset()
 {
     if ($_SERVER['REMOTE_ADDR'] !== $_SERVER['SERVER_ADDR']) {
         return new Response('You don\'t have permissions to do that.', 403);
     }
     DB::table('folders')->truncate();
     DB::table('groups')->truncate();
     DB::table('images')->truncate();
     DB::table('images_folders')->truncate();
     DB::table('libraries')->truncate();
     DB::table('pages')->truncate();
     DB::table('pages_libraries')->truncate();
     DB::table('projects')->truncate();
     DB::table('templates')->truncate();
     DB::table('themes')->truncate();
     DB::table('users_projects')->truncate();
     $this->emptyFolders();
     $this->seeder->seed();
     $this->seeder->seedDemoProjects();
     file_put_contents($this->lastResetPath, '<?php return ' . Carbon::now()->timestamp . ';');
     return new Response('Reset database successfully.', 200);
 }