Esempio n. 1
0
 public function getList()
 {
     $dbfolders = Folder::where('parent_id', 15)->get();
     $dbfolders->push(Folder::find(15));
     $result = [];
     foreach ($dbfolders as $folder) {
         $files = $folder->Files;
         foreach ($files as $file) {
             $file->destroy($file->id);
             $myFile = new MyFile();
             try {
                 $myFile->FileDelete($this->upload_path . $file->year . '-' . $file->month . '/', $file->name);
             } catch (exception $ex) {
             }
         }
         $folder->destroy($folder->id);
         Folder_File_Attached::where('folder_id', $folder->id)->delete();
     }
     return \Response::json($result);
 }
Esempio n. 2
0
 public function postDelete()
 {
     try {
         $File = File::find(\Input::get('id'));
         $File->destroy($File->id);
         Folder_File_Attached::where('file_id', $File->id)->delete();
         $myFile = new MyFile();
         $myFile->FileDelete($this->upload_path . $File->year . '/' . $File->month . '/', $File->name);
     } catch (exception $ex) {
         return \Response::json($ex->getMessage());
     }
     return \Response::json('deleted');
 }