Example #1
0
 /**
  * Function Download File
  * to Response Form User
  * @Request @Name,@Code etc
  *
  * @return response ajax
  */
 public function onDownload($id)
 {
     $path = base_path() . '/public/uploads/';
     $id = $id;
     $row = \App\Models\File::select(['name'])->where('name', $id)->first();
     if ($row) {
         $file = $path . $row->name;
         return response()->download($file);
     } else {
     }
 }
Example #2
0
 public static function findWithExtension($id)
 {
     $file = File::select("files.*", "extensions.name as extension")->join("extensions", "files.extension_id", "=", "extensions.id")->where("files.id", $id)->first();
     return $file;
 }