}
/**
* Remove the specified resource from storage.
*
* @param AppModelsinvoices_details $invoices_details
* @return IlluminateHttpResponse
*/
public function destroy(Request $request)
{
$invoices = invoices_attachments::findOrFail($request->id_file);
$invoices->delete();
Storage::disk('public_uploads')->delete($request->invoice_number.'/'.$request->file_name);
session()->flash('delete', 'تم حذف المرفق بنجاح');
return back();
}
public function get_file($invoice_number,$file_name)
{
$contents= Storage::disk('public_uploads')->getDriver()->getAdapter()->applyPathPrefix($invoice_number.'/'.$file_name);
return response()->download( $contents);
}
public function open_file($invoice_number,$file_name)
{
$files = Storage::disk('public_uploads')->getDriver()->getAdapter()->applyPathPrefix($invoice_number.'/'.$file_name);
return response()->file( $files);
}
}