示例#1
0
 /**
  * Delete the directory with the filename and all files inside
  * Fire FileWasDeleted Event
  *
  */
 public function handle()
 {
     if (Storage::exists($this->getFileDirectory())) {
         Storage::deleteDirectory($this->getFileDirectory());
     }
     event(new FileWasDeleted($this->filename));
 }
示例#2
0
 public function tearDown()
 {
     parent::tearDown();
     $this->refreshApplication();
     Storage::deleteDirectory('testing/ahk');
     Storage::deleteDirectory('testing/cms');
     Storage::deleteDirectory('testing/img');
 }
 public function deleteFileVer($id, $ver)
 {
     $entry = FileRecord::where('id', '=', $id)->firstOrFail();
     Storage::delete($entry->owner_id . $entry->id . $entry->filename . "/" . $ver);
     $files = Storage::allFiles($entry->owner_id . $entry->id . $entry->filename . "/");
     if (count($files) == 0) {
         Storage::deleteDirectory($entry->owner_id . $entry->id . $entry->filename);
         $entry->delete();
     } else {
         if ($ver == $entry->public_version) {
             $last = str_replace($entry->owner_id . $entry->id . $entry->filename . "/", "", end($files));
             $entry->public_version = $last;
             $entry->save();
         }
     }
     return redirect('/');
 }
 /**
  *
  */
 private function reset_crawl()
 {
     echo $this->state->state_name . " Resetting Crawl ... ";
     $state = snake_case($this->state->state_name);
     $state_code = strtolower($this->state->state_code);
     // Delete Crawl Files
     Storage::delete('sexoffenders/' . $state . '.sql.gz');
     Storage::deleteDirectory('sexoffenders/' . $state, true);
     Storage::deleteDirectory('sexoffenders/_html/' . str_slug($this->state->state_name), true);
     // DB Reset
     if ($this->counties_table) {
         DB::table($state_code . '_counties')->update(['status' => '0']);
     }
     DB::table($state_code . '_offenders')->truncate();
     DB::table($state_code . '_offenses')->truncate();
     if ($this->profiles_table) {
         DB::table($state_code . '_profiles')->truncate();
     }
     //
     echo "State Crawl Refreshed" . PHP_EOL;
     return;
 }
 public function decline($id)
 {
     $entry = Achievements::where('achievement_id', '=', $id)->firstOrFail();
     $file = FileRecord::where('id', $id)->firstOrFail();
     $owner = User::where('id', $file->owner_id)->firstOrFail();
     $data = ['fileName' => $entry->name];
     Mail::queue('mail.hrDeny', $data, function ($message) use(&$owner) {
         $message->to($owner->email, $owner->fname)->subject('Achievement rejected');
     });
     Storage::deleteDirectory($file->owner_id . $file->id . $file->filename);
     $entry->delete();
     $file->delete();
     return redirect('/hr/verify');
 }
示例#6
0
 /**
  * Delete content
  * @param  string $path path to the content
  * @return bool
  */
 public function deleteContent($path)
 {
     if (is_file(storage_path() . '/app/' . $path)) {
         return Storage::delete($path);
     }
     return Storage::deleteDirectory($path);
 }