@@ -66,7 +66,7 @@ public function upload($file, $path)
66
66
67
67
$ fileName = now ()->timestamp . '- ' . $ file ->getClientOriginalName ();
68
68
69
- // $this->mkdir_if_not_exists($destinationPath);
69
+ // $this->mkdir_if_not_exists($destinationPath);
70
70
71
71
//$this->disk()->put();
72
72
$ this ->disk ()->putFileAs ($ destinationPath , $ file , $ fileName );
@@ -83,7 +83,7 @@ function mkdir_if_not_exists($dirPath)
83
83
84
84
public function uploadImage (UploadedFile $ uploadedFile , $ path = null )
85
85
{
86
- // $image = Image::make($uploadedFile->getRealPath());
86
+ // $image = Image::make($uploadedFile->getRealPath());
87
87
}
88
88
89
89
public function isFile ($ file ): bool
@@ -96,4 +96,29 @@ public function isImage($file): bool
96
96
return true ;
97
97
}
98
98
99
+ public function attachFromUrl ($ url , array $ options = null )
100
+ {
101
+ # code...
102
+ }
103
+
104
+ public function attachFromStream ($ stream , $ filename , $ disk = null )
105
+ {
106
+ if ($ stream === null ) {
107
+ return null ;
108
+ }
109
+
110
+ $ this ->disk = $ this ->disk ?: ($ disk ?: Storage::getDefaultDriver ());
111
+
112
+ $ driver = Storage::disk ($ this ->disk );
113
+
114
+ $ this ->filename = $ filename ;
115
+ $ this ->filepath = $ this ->filepath ?: ($ this ->getStorageDirectory () . $ this ->getPartitionDirectory () . $ this ->getDiskName ());
116
+
117
+ $ driver ->putStream ($ this ->filepath , $ stream );
118
+
119
+ $ this ->filesize = $ driver ->size ($ this ->filepath );
120
+ $ this ->filetype = $ driver ->mimeType ($ this ->filepath );
121
+
122
+ return $ this ;
123
+ }
99
124
}
0 commit comments